Message359061
In [12]: cProfile.run("for _ in range(100_000): Bar()")
200003 function calls in 0.136 seconds
Ordered by: standard name
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.047 0.047 0.136 0.136 <string>:1(<module>)
100000 0.079 0.000 0.089 0.000 typing.py:865(__new__)
100000 0.010 0.000 0.010 0.000 {built-in method __new__ of type object at 0x55ab65861ac0}
1 0.000 0.000 0.136 0.136 {built-in method builtins.exec}
1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}
In [13]: # And typing.py:865 points to
In [14]: inspect.getsourcelines(Generic.__new__)
Out[14]:
([' def __new__(cls, *args, **kwds):\n',
' if cls in (Generic, Protocol):\n',
' raise TypeError(f"Type {cls.__name__} cannot be instantiated; "\n',
' "it can be used only as a base class")\n',
' if super().__new__ is object.__new__ and cls.__init__ is not object.__init__:\n',
' obj = super().__new__(cls)\n',
' else:\n',
' obj = super().__new__(cls, *args, **kwds)\n',
' return obj\n'],
865) |
|
Date |
User |
Action |
Args |
2019-12-30 21:53:54 | Ruslan Dautkhanov | set | recipients:
+ Ruslan Dautkhanov, gvanrossum, levkivskyi |
2019-12-30 21:53:54 | Ruslan Dautkhanov | set | messageid: <1577742834.63.0.556900400162.issue39168@roundup.psfhosted.org> |
2019-12-30 21:53:54 | Ruslan Dautkhanov | link | issue39168 messages |
2019-12-30 21:53:54 | Ruslan Dautkhanov | create | |
|