On 10/09/2013 10:46 PM, Mark Shannon wrote: > There is no need to create an "undefined" value. > Rather than define a parameter by assigning a fake value, just don't > define it. We already do this for non-parameter locals and it could be > extended to parameters. > > 'range' would be defined thus: > > def range([start,] stop, [step], /): > try: > start > except UnboundLocalError: > start = 0 > try: > step > except UnboundLocalError: > step = 1 > ... That's a clever, and intuitive, idea. Though the try/excepts look awfully clumsy. Perhaps we could add (egad, no, I can't believe I'm saying this) a new built-in function that tells you whether or not a local variable has been assigned to yet? def range([start,] stop, [step], /): if not bound(start): start = 0 if not bound(step): step = 1 ... Anyway, this section is in the "Notes For Future Implementors" section, so as long as we never actually implement the syntax we don't need to solve the problem. //arry/ -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20131009/73b62b05/attachment.html>
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