map/filter/reduce/lambda opinions and background unscientific mini-survey
Ron Adam
rrr at ronadam.com
Wed Jul 6 10:33:47 EDT 2005
Tom Anderson wrote:
>> del -> delete
>
>
> How about just getting rid of del? Removal from collections could be
> done with a method call, and i'm not convinced that deleting variables
> is something we really need to be able to do (most other languages
> manage without it).
Since this is a Python 3k item... What would be the consequence of
making None the default value of an undefined name? And then assigning
a name to None as a way to delete it?
Some benefits
=============
*No more NamesError exceptions!
print value
>> None
value = 25
print value
>> 25
value = None #same as 'del value'
*No initialization needed for a while loop!
While not something:
if <condition>:
something = True
*Test if name exists without using a try-except!
if something == None:
something = value
*And of course one less keyword!
Any drawbacks?
Cheers,
Ron
PS... not much sleep last night, so this may not be well thought out.
More information about the Python-list
mailing list