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

2008-09-27 Thread MRAB
On Sep 27, 4:16 am, Ben Finney <[EMAIL PROTECTED]> wrote: > process <[EMAIL PROTECTED]> 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 bui

Re: what does ` ` do in ' '.join([`x * x` for x in range(1, 6)])?

2008-09-27 Thread Roy Smith
In article <[EMAIL PROTECTED]>, alex23 <[EMAIL PROTECTED]> wrote: > ' '.join((str(x * x) for x in range(1,6))) Aren't the outer set of parens redundant? This works just as well: ' '.join(str(x * x) for x in range(1,6)) -- http://mail.python.org/mailman/listinfo/python-list

Re: what does ` ` do in ' '.join([`x * x` for x in range(1, 6)])?

2008-09-27 Thread alex23
On Sep 27, 3:58 pm, r0g <[EMAIL PROTECTED]> wrote: > Ah, just spotted the backticks - they just return whatever's inside them > as a string. No, they return the repr() of the object inside. The output of __repr__ -has- to be a string, but typecasting into string isn't the intention of repr() (or t

Re: what does ` ` do in ' '.join([`x * x` for x in range(1, 6)])?

2008-09-26 Thread r0g
process wrote: > ' '.join([`x * x` for x in range(1, 6)]) > > exactly what does this symbol do and what does it stand for? Ah, just spotted the backticks - they just return whatever's inside them as a string. -- http://mail.python.org/mailman/listinfo/python-list

Re: what does ` ` do in ' '.join([`x * x` for x in range(1, 6)])?

2008-09-26 Thread r0g
process wrote: > ' '.join([`x * x` for x in range(1, 6)]) > > exactly what does this symbol do and what does it stand for? Which symbol, the '*' ??? Are you kidding? -- http://mail.python.org/mailman/listinfo/python-list

Re: what does ` ` do in ' '.join([`x * x` for x in range(1, 6)])?

2008-09-26 Thread alex23
On Sep 27, 12:39 pm, process <[EMAIL PROTECTED]> wrote: > ' '.join([`x * x` for x in range(1, 6)]) > > exactly what does this symbol do and what does it stand for? `` is the same as repr(). I'm pretty sure the backtick operator has been removed from 3.0. In the context of the code sample you post

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

2008-09-26 Thread Ben Finney
process <[EMAIL PROTECTED]> 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(

what does ` ` do in ' '.join([`x * x` for x in range(1, 6)])?

2008-09-26 Thread process
' '.join([`x * x` for x in range(1, 6)]) exactly what does this symbol do and what does it stand for? -- http://mail.python.org/mailman/listinfo/python-list