Ethan -- I'm just getting back to this question. If you recall, you asked:
[snip]
8
script with possible name clashes
eggs = 'scrambled eggs'
meat = 'steak'
class Breakfast():
meat = 'spam'
def serve(self):
print(Here's
Gerald Britton wrote:
I now understand the Python does
not consider a class definition as a separate namespace as it does for
function definitions. That is a helpful understanding.
That is not correct. Classes are separate namespaces -- they just
aren't automatically searched. The only
Gerald Britton wrote:
I now understand the Python does
not consider a class definition as a separate namespace as it does for
function definitions. That is a helpful understanding.
That is not correct. Classes are separate namespaces -- they just
aren't automatically searched. The only
On Tue, Apr 19, 2011 at 10:31 AM, Ethan Furman et...@stoneleaf.us wrote:
Gerald Britton wrote:
I now understand the Python does
not consider a class definition as a separate namespace as it does for
function definitions. That is a helpful understanding.
That is not correct. Classes are
On 4/19/2011 10:58 AM, Gerald Britton wrote:
serve method unless it is qualified. I now understand the Python does
not consider a class definition as a separate namespace as it does for
function definitions.
Class namespaces are separate namespaces but not in the same way as for
functions.
On Tue, 19 Apr 2011 17:47:40 +0100, Gerald Britton
gerald.brit...@gmail.com wrote:
Gerald Britton wrote:
I now understand the Python does
not consider a class definition as a separate namespace as it does for
function definitions. That is a helpful understanding.
That is not correct.
On Wed, Apr 20, 2011 at 8:00 AM, Rhodri James
rho...@wildebst.demon.co.uk wrote:
Language abuse: it's not just Python. A donation of just $5 will keep a
programmer in prepositions for a month. $50 will supply enough articles to
keep a small company understandable for over a year. With your
Rhodri James rho...@wildebst.demon.co.uk writes:
Language abuse: it's not just Python. A donation of just $5 will keep
a programmer in prepositions for a month. $50 will supply enough
articles to keep a small company understandable for over a year. With
your generous help, we can beat this
On 01/-10/-28163 02:59 PM, Ben Finney wrote:
Rhodri Jamesrho...@wildebst.demon.co.uk writes:
Language abuse: it's not just Python. A donation of just $5 will keep
a programmer in prepositions for a month. $50 will supply enough
articles to keep a small company understandable for over a year.
On Tue, Apr 19, 2011 at 7:49 PM, Dave Angel da...@ieee.org wrote:
On 01/-10/-28163 02:59 PM, Ben Finney wrote:
Rhodri Jamesrho...@wildebst.demon.co.uk writes:
Language abuse: it's not just Python. A donation of just $5 will keep
a programmer in prepositions for a month. $50 will supply
I apologize if this has been answered before or if it is easy to find
in the docs. (I couldn't find it but might have missed it)
I'm trying to understand the differences between namespaces in class
definitions vs. function definitions. Consider this function:
def a():
... foo = 'foo'
...
On Sun, Apr 17, 2011 at 12:30 PM, Gerald Britton
gerald.brit...@gmail.com wrote:
I apologize if this has been answered before or if it is easy to find
in the docs. (I couldn't find it but might have missed it)
I'm trying to understand the differences between namespaces in class
definitions
Gerald Britton wrote:
However, I would like a deeper
understanding of why I cannot use foo as an unqualified variable
inside the method in the class. If Python allowed such a thing, what
problems would that cause?
8
script with possible
Gerald Britton wrote:
For my
final attempt, I add the prefix a. to my use of foo
class a():
... foo = 'foo'
... def g(x):
... return a.foo
...
The first parameter to any method in a class* is going to be the
instance of that class, and is usually named 'self'. So your
On Apr 17, 8:56 pm, Chris Rebert c...@rebertia.com wrote:
On Sun, Apr 17, 2011 at 12:30 PM, Gerald Britton
gerald.brit...@gmail.com wrote:
I apologize if this has been answered before or if it is easy to find
in the docs. (I couldn't find it but might have missed it)
I'm trying
15 matches
Mail list logo