You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=Nonecreated_at=<Date2016-03-06.18:47:20.307>labels= ['interpreter-core']
title='super() does not work in nested functions, genexps, listcomps, and gives misleading exceptions'updated_at=<Date2020-01-09.18:40:36.658>user='https://github.com/ztane'
super() without arguments gives proper "super() without arguments" in functions, generator functions nested in methods, if *those* do not have arguments. But if you use super() in a nested function that takes an argument, or in a generator expression or a comprehension, you'd get
Got exception: TypeError super(type, obj): obj must be an instance or subtype of type
which is really annoying. Furthermore, if a nested function took another instance of type(self) as the first argument, then super() could refer unexpectedly to wrong instance:
now the super() call would not have implied self of calculate as the first argument, but the other argument of the nested function, all without warnings.
I believe it is a mistake that these nested functions can see __class__ at all, since it would just mostly lead them misbehaving unexpectedly.
ztanemannequin
changed the title
super() does not work nested
super() does not work in nested functions, genexps, listcomps, and gives misleading exceptions
Mar 6, 2016
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: