PEP 260: simplify xrange()
Roman Suzi
rnd at onego.ru
Tue Jun 26 15:51:12 EDT 2001
On Tue, 26 Jun 2001, D-Man wrote:
>On Tue, Jun 26, 2001 at 10:47:28PM +0400, Roman Suzi wrote:
>|
>| What about str(x)?
>
>It's not needed :
>
>>>> class Example:
>... def __repr__( self ) : return "Hello World"
>...
>>>> str( Example() )
>'Hello World'
Thanks, I've not known this.
>>>>
>
>I have no problems with the PEP and I think that the reduced code size
>is a good thing.
It is, of course.
But after PEP 260 xrange is sequence no more.
And also I think "x in xrange(...)" and
"x not in xrange(...)" should not be dropped,
because it is very near to
for x in xrange(...)
and has interesting use as in:
if n in xrange(1, 101, 2): # odd number from [1, 100]
...
Sincerely yours, Roman Suzi
--
_/ Russia _/ Karelia _/ Petrozavodsk _/ rnd at onego.ru _/
_/ Tuesday, June 26, 2001 _/ Powered by Linux RedHat 6.2 _/
_/ "It is better to be brief than boring." _/
More information about the Python-list
mailing list