A small suggestion for Python
Matt Dunford
kno at jtan.com
Sat Jan 13 17:44:38 EST 2001
"Edward C. Jones" <edcjones at erols.com> writes:
>I have been programming in Python for several years. I still
>occasionally make mistakes with functions (such as sort) that
>return only "None". I suggest that functions like sort should
>return either "Nothing" or nothing. "Nothing" would be exactly
>like "None" except it can't be assigned. Whether "Nothing" or
>nothing is used, the statement "x= y.sort()" would raise a
>run-time Exception.
>Thanks,
>Ed Jones
I'm not too fond of this idea. If you misuse a method, whose fault is
it? Python's or your own? I think we should keep sort the way it is.
Although, I wouldn't mind having a builtin method that returns a sorted
array. Then we could do something like this:
dict = { 'this' : 1, 'that' : 2 }
for key in dict.keys().sort():
print key
--
More information about the Python-list
mailing list