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

Ben Finney bignose+hates-spam at benfinney.id.au
Sat Sep 27 05:16:08 CEST 2008


process <circularfunc 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)])

-- 
 \           “Killing the creator was the traditional method of patent |
  `\                        protection” —Terry Pratchett, _Small Gods_ |
_o__)                                                                  |
Ben Finney



More information about the Python-list mailing list