A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2009-April/088006.html below:

[Python-Dev] issue5578 - explanation

[Python-Dev] issue5578 - explanation [Python-Dev] issue5578 - explanationMaciej Fijalkowski fijall at gmail.com
Wed Apr 1 05:15:29 CEST 2009
So. The issue was closed and I suppose it was closed by not entirely
understanding
the problem (or I didn't get it completely).

The question is - what the following code should do?

def f():
  a = 2
  class C:
    exec 'a = 42'
    abc = a
  return C

print f().abc

(quick answer - on python2.5 it return 42, on python 2.6 and up it
returns 2, the patch changes
it to syntax error).

I would say that returning 2 is the less obvious thing to do. The
reason why IMO this should
be a syntax error is this code:

def f():
  a = 2
  def g():
    exec 'a = 42'
    abc = a

which throws syntax error.

Cheers,
fijal
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4