16.01.14 08:05, Guido van Rossum написав(ла):
In this specific case it's clear to me that the special-casing of
negative count is intentional -- presumably it emulates sequence
repetition, where e.g. 'a'*-1 == ''.

In this specific case it's contrary to sequence repetition. Because repeat('a', -1) repeats 'a' forever. This is a point of Vajrasky's issue [1].

But not accepting None is laziness -- accepting either a number or
None requires much more effort, if you need to have the number as a C
integer. I'm not sure how AC could make this any easier, unless you
want to special-case maxint or -maxint-1.

getattr(foo, 'bar', None) is not the same as getattr(foo, 'bar'). So None can't be used as universal default value.


[1] http://bugs.python.org/issue19145


_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to