On 08.11.12 03:11, Ned Batchelder wrote:
Sorry, I should have been clearer: I was asking about weird not to say,
This is weird and should be changed!, but to get clarification from
Serhiy about his statement, It will be weird if a dict comprehension
and a plain loop will be inconsistent.
On 11/6/2012 5:12 PM, Guido van Rossum wrote:
On Tue, Nov 6, 2012 at 9:58 AM, Ned Batchelder n...@nedbatchelder.com wrote:
On 11/6/2012 11:26 AM, R. David Murray wrote:
On Tue, 06 Nov 2012 18:14:38 +0200, Serhiy Storchaka storch...@gmail.com
wrote:
Another counterintuitive (and possible
On Wed, Nov 7, 2012 at 10:13 PM, Ned Batchelder n...@nedbatchelder.com wrote:
There are plenty of places where different Python implementations differ,
and even careful observers had different ideas about how keys and values
were ordered in dict displays (I thought it was like a function call,
On Thu, Nov 8, 2012 at 1:11 AM, Nick Coghlan ncogh...@gmail.com wrote:
The implementation is right, the docs are wrong sounds good to me,
as it's easy to justify the out of order evaluation in terms of the
equivalent item assignment statements:
What do other Pythons than CPython do currently?
On 7 November 2012 15:16, Chris Angelico ros...@gmail.com wrote:
On Thu, Nov 8, 2012 at 1:11 AM, Nick Coghlan ncogh...@gmail.com wrote:
The implementation is right, the docs are wrong sounds good to me,
as it's easy to justify the out of order evaluation in terms of the
equivalent item
On Wed, Nov 7, 2012 at 4:13 AM, Ned Batchelder n...@nedbatchelder.com wrote:
I think it's unfortunate that the current patch in the referenced bug (
http://bugs.python.org/issue11205 ) fixes the problem by adding one more
bytecode to the compiled Python. The other alternative seems to be
On Thu, Nov 8, 2012 at 1:54 AM, Guido van Rossum gu...@python.org wrote:
On Wed, Nov 7, 2012 at 4:13 AM, Ned Batchelder n...@nedbatchelder.com wrote:
We've gone out of our way to
maintain backward compatibility with the implemented behavior before
(ordering of dict keys, for example).
Not
On Thu, Nov 8, 2012 at 12:54 AM, Guido van Rossum gu...@python.org wrote:
On Wed, Nov 7, 2012 at 4:13 AM, Ned Batchelder n...@nedbatchelder.com wrote:
If the bug report is accurate, CPython and the reference manual have
disagreed since Python 2.5, and many of us are now surprised to hear it,
Ok, somebody go for it! (Also please refer to my pronouncement in the bug
-- I've gotta run.)
On Wed, Nov 7, 2012 at 7:12 AM, Nick Coghlan ncogh...@gmail.com wrote:
On Thu, Nov 8, 2012 at 12:54 AM, Guido van Rossum gu...@python.org
wrote:
On Wed, Nov 7, 2012 at 4:13 AM, Ned Batchelder
On 07.11.12 17:12, Nick Coghlan wrote:
Since you've indicated the implementation is in the wrong here and you
also want to preserve opcode semantics, I think Skip's patch is
correct, but also needs to be applied to dict comprehensions (now we
have them). The extra bytecode is only ROT_TWO, which
On 11/7/2012 9:54 AM, Guido van Rossum wrote:
Hm. I really don't think that is a good development for Python to
compromise in the area of expression evaluation order where side
effects are involved.
I agreee. I think Python's simple left to right evaluation order is one
of its virtues.
A
On 11/7/2012 10:17 AM, Guido van Rossum wrote:
Ok, somebody go for it! (Also please refer to my pronouncement in the
bug -- I've gotta run.)
Done. http://bugs.python.org/issue11205?@ok_message=msg 175120
--
Terry Jan Reedy
___
Python-Dev mailing
On 11/7/2012 12:08 PM, Serhiy Storchaka wrote:
On 07.11.12 17:12, Nick Coghlan wrote:
Since you've indicated the implementation is in the wrong here and you
also want to preserve opcode semantics, I think Skip's patch is
correct, but also needs to be applied to dict comprehensions (now we
have
The dict display is considered an *expression* and thus must follow
the L2R rule. The assignment is explicitly covered by the R2L rule for
assignments (only). Weird or not, those are the rules, and I don't
want to change them.
On Wed, Nov 7, 2012 at 1:39 PM, Ned Batchelder n...@nedbatchelder.com
On 11/7/2012 4:39 PM, Ned Batchelder wrote:
Just to be clear: the reference guide says that the behavior *SHOULD BE*
(but is not yet) this:
Python 3.3.0
{print(a):print(b)}
a
b
{None: None}
d = {}
d[print(a)] = print(b)
b
a
Is this or is this
On 08/11/12 08:39, Ned Batchelder wrote:
Just to be clear: the reference guide says that the behavior *SHOULD BE* (but
is not yet) this:
Python 3.3.0
{print(a):print(b)}
a
b
{None: None}
That was the behaviour of Python 2.4:
py def pr(x):
... print x
...
py {pr(1): pr(2), pr(3):
On 11/7/2012 5:11 PM, Terry Reedy wrote:
On 11/7/2012 4:39 PM, Ned Batchelder wrote:
Just to be clear: the reference guide says that the behavior *SHOULD BE*
(but is not yet) this:
Python 3.3.0
{print(a):print(b)}
a
b
{None: None}
d = {}
d[print(a)] =
Hi All,
I bumped into this using Michael Foord's Mock library.
It feels like a bug to me, but thought I'd ask here before logging one
in the tracker in case people know that we won't be able to fix it:
On 05/11/2012 13:43, Michael Foord wrote:
class Foo(object):
... def __setattr__(s, k,
On Tue, Nov 6, 2012 at 1:18 AM, Chris Withers ch...@simplistix.co.uk wrote:
Hi All,
I bumped into this using Michael Foord's Mock library.
It feels like a bug to me, but thought I'd ask here before logging one in
the tracker in case people know that we won't be able to fix it:
On 05/11/2012
On 11/6/2012 1:18 AM, Chris Withers wrote:
Hi All,
I bumped into this using Michael Foord's Mock library.
It feels like a bug to me, but thought I'd ask here before logging one
in the tracker in case people know that we won't be able to fix it:
On 05/11/2012 13:43, Michael Foord wrote:
On 06/11/2012 12:01, Nick Coghlan wrote:
As noted, it's really only counterintuitive if your intuition is
primed to expect C style right to left chained assignments.
Python, on the other hand, is able to preserve primarily left to right
evaluation in this case with only the far right hand
On 2012-11-06 15:02, Rob Cliffe wrote:
On 06/11/2012 12:01, Nick Coghlan wrote:
As noted, it's really only counterintuitive if your intuition is
primed to expect C style right to left chained assignments.
Python, on the other hand, is able to preserve primarily left to right
evaluation in
+1 to what Nick said. And I thought about this carefully when
designing the language. It's not a bug. The note about assignment RHS
being evaluated before LHS is normative -- you just have to interpret
RHS as after the *last* '=' symbol. Assignment itself is *not* an
expression.
On Tue, Nov 6,
On 06.11.12 14:01, Nick Coghlan wrote:
Python, on the other hand, is able to preserve primarily left to right
evaluation in this case with only the far right hand expression needing
to be evaluated out of order.
I'm surprised, but it is really so.
{}[print('foo')] = print('bar')
bar
On Tue, 06 Nov 2012 18:14:38 +0200, Serhiy Storchaka storch...@gmail.com
wrote:
Another counterintuitive (and possible wrong) example:
{print('foo'): print('bar')}
bar
foo
{None: None}
http://bugs.python.org/issue11205
--David
___
On 11/6/2012 11:26 AM, R. David Murray wrote:
On Tue, 06 Nov 2012 18:14:38 +0200, Serhiy Storchaka storch...@gmail.com
wrote:
Another counterintuitive (and possible wrong) example:
{print('foo'): print('bar')}
bar
foo
{None: None}
http://bugs.python.org/issue11205
This
On Nov 6, 2012 1:05 PM, Ned Batchelder n...@nedbatchelder.com wrote:
On 11/6/2012 11:26 AM, R. David Murray wrote:
On Tue, 06 Nov 2012 18:14:38 +0200, Serhiy Storchaka storch...@gmail.com
wrote:
Another counterintuitive (and possible wrong) example:
{print('foo'): print('bar')}
On 11/6/2012 1:19 PM, Devin Jeanpierre wrote:
On Nov 6, 2012 1:05 PM, Ned Batchelder n...@nedbatchelder.com
mailto:n...@nedbatchelder.com wrote:
On 11/6/2012 11:26 AM, R. David Murray wrote:
On Tue, 06 Nov 2012 18:14:38 +0200, Serhiy Storchaka
storch...@gmail.com
MRAB wrote:
That would make augmented assignment more difficult. For example, how
would you write the equivalent of x -= y?
SUBTRACT x FROM y.
CLOSE POST WITH SMILEY.
--
Greg
___
Python-Dev mailing list
Python-Dev@python.org
On Tue, Nov 6, 2012 at 9:58 AM, Ned Batchelder n...@nedbatchelder.com wrote:
On 11/6/2012 11:26 AM, R. David Murray wrote:
On Tue, 06 Nov 2012 18:14:38 +0200, Serhiy Storchaka storch...@gmail.com
wrote:
Another counterintuitive (and possible wrong) example:
{print('foo'):
On 06.11.12 21:00, Ned Batchelder wrote:
If someone really needs to control whether the keys or values
are evaluated first, they shouldn't use a dict literal.
Not only a dict literal.
{print('foo'): print('bar') for x in [1]}
bar
foo
{None: None}
31 matches
Mail list logo