> > ...and really means this...
> > class C:
> > x = 1
> > def f(self,y): return T.x + y
>
> I don't understand what T is. Did you mean C?
Yes, I meant C. Thanks.
>
> If so, you are wrong. self.x is not the same as .x due to
> inheritance rules. Consider one example:
>
Thanks for the nice e
On Sat, 27 Feb 2010 15:57:15 -0800, dontspamleo wrote:
> I think a big part of the problem is that the scoping rules in Python
> are inconsistent because classes are a different kind of object. An
> example helps:
[...]
> But this doesn't work...
> class C:
> x = 1
> def f(self,y): return x +
On Feb 27, 2010, at 6:57 PM, dontspamleo wrote:
>
>
> http://bioscreencastwiki.com/Python_Variable_scope_gymnastics
Broken link:
Site settings could not be loaded
We were unable to locate the API to request site settings. Please see below for
debugging information.
HTTP Response Status Cod
I think a big part of the problem is that the scoping rules in Python
are inconsistent because classes are a different kind of object. An
example helps:
This works:
x = 1
def f(y): return y + x
This works:
def f():
x = 1
def g(y): return x + y
return g(2)
But this doesn't work...
class
dontspamleo writes:
> Hi Arnaud et al,
>
> Here is the link to the bug report from which the discussion in PEP
> 289 was extracted:
>
> http://bugs.python.org/issue872326
>
> It looks like they were fixing a bunch of bugs and that this
> discussion was one of the many in that thread.
>
> Here is
Hi Arnaud et al,
Here is the link to the bug report from which the discussion in PEP
289 was extracted:
http://bugs.python.org/issue872326
It looks like they were fixing a bunch of bugs and that this
discussion was one of the many in that thread.
Here is another post which points to the core of
dontspamleo writes:
> @Arnaud: I tried to find your earlier post -- googled "Arnaud lambda"
> -- but couldn't.
I remembered after posting that I sent this to python-ideas. Here is the
first message in the thread:
http://mail.python.org/pipermail/python-ideas/2007-December/001260.html
In this t
Hi Folks,
Thanks everyone for the great contributions! I understand this better
now. The distinction between a shorthand for a function definition and
a shorthand for a loop iteration is crucial.
Also: thanks for pointing out the even the list comprehension doesn't
work in py3. That was incredibl
Nomen Nescio wrote:
> Hello,
>
> Can someone help me understand what is wrong with this example?
>
> class T:
> A = range(2)
> B = range(4)
> s = sum(i*j for i in A for j in B)
>
> It produces the exception:
>
> : global name 'j' is not defined
It's due to scoping rules for classes and/or
On Feb 24, 12:21 pm, "Alf P. Steinbach" wrote:
> * Nomen Nescio:
>
> > Hello,
>
> > Can someone help me understand what is wrong with this example?
>
> > class T:
> > A = range(2)
> > B = range(4)
> > s = sum(i*j for i in A for j in B)
>
> > It produces the exception:
>
> > : global name 'j'
On Feb 24, 5:52 am, Nomen Nescio wrote:
> Hello,
>
> Can someone help me understand what is wrong with this example?
>
> class T:
> A = range(2)
> B = range(4)
> s = sum(i*j for i in A for j in B)
>
> It produces the exception:
>
> : global name 'j' is not defined
>
> The exception above is
* Nomen Nescio:
Hello,
Can someone help me understand what is wrong with this example?
class T:
A = range(2)
B = range(4)
s = sum(i*j for i in A for j in B)
It produces the exception:
: global name 'j' is not defined
Which Python implementation are you using?
I can't reproduce the er
Hello,
Can someone help me understand what is wrong with this example?
class T:
A = range(2)
B = range(4)
s = sum(i*j for i in A for j in B)
It produces the exception:
: global name 'j' is not defined
The exception above is especially confusing since the following similar example
(I jus
13 matches
Mail list logo