Quoting Andrew Bennetts <andrew-pythondev at puzzling.org>: > Although this would not (I hope) be a common use-case, what would this code > mean: > > with foo: > def func(arg): > .attrib = value > pass > > ? > > I'm not entirely sure it's safe to say they don't conflict, although I don't > see this case as a serious problem. The proposal would basically be that the above becomes equivalent to: with foo: def func(arg): with func: .attrib = value (except that the above wouldn't actually work, as 'func' isn't bound to anything in it's own body) Personally, I'd prefer to see function attributes made possible by allowing references to the name of the function from within the definition of the function.Eg: def func(arg): func.attrib = value Then a 'function attribute block' can easily be delimited by using a with block as I do above. However, I don't know if this idea has been considered and discarded in the past. Cheers, Nick -- Nick Coghlan Brisbane, Australia
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4