Build-in 'repr' function (was: what does ` ` do in ' '.join([`x * x` for x in range(1, 6)])?)

MRAB google at mrabarnett.plus.com
Sat Sep 27 14:42:40 CEST 2008


On Sep 27, 4:16 am, Ben Finney <bignose+hates-s... at benfinney.id.au>
wrote:
> process <circularf... at gmail.com> writes:
> > ' '.join([`x * x` for x in range(1, 6)])
>
> > exactly what does this symbol do and what does it stand for?
>
> It's an obsolete, deprecated syntactic sugar for (what is now
> implemented as) the built-in 'repr' function.
>
> Instead, write the above as:
>
>     ' '.join([repr(x * x) for x in range(1, 6)])
>
I'd classify it as one of Guido's mistakes! :-)



More information about the Python-list mailing list