On 18 Oct 2010 22:29:27 GMT Steven D'Aprano
st...@remove-this-cybersource.com.au wrote:
On Mon, 18 Oct 2010 09:34:07 -0700, Chris Rebert wrote:
Also, Python's scoping rules, particularly for class-level scopes,
don't work the way programmers from languages where nested classes
are common
Steven D'Aprano steve-remove-t...@cybersource.com.au wrote:
Avoiding namespace pollution and information hiding are two good reasons
for nesting classes.
Python already has a great mechanism for regulating namespaces:
modules importing. Information hiding seems to go against the 'all
Hello.
I have a class A that contains two classes B and C:
class A:
class B:
self.x = 2
class C:
Is there a way to access the x defined in B in class C?
Thanks.
--
F. Delente
--
http://mail.python.org/mailman/listinfo/python-list
On 2010-10-18, f...@slick.airforce-one.org f...@slick.airforce-one.org
wrote:
Hello.
I have a class A that contains two classes B and C:
class A:
class B:
self.x = 2
class C:
Is there a way to access the x defined in B in class C?
That's not valid Python code. Do you mean:
On 2010-10-18, Neil Cerutti ne...@norwich.edu wrote:
On 2010-10-18, f...@slick.airforce-one.org f...@slick.airforce-one.org
wrote:
Hello.
I have a class A that contains two classes B and C:
class A:
class B:
self.x = 2
class C:
Is there a way to access the x defined in B
Neil Cerutti ne...@norwich.edu wrote:
I have a class A that contains two classes B and C:
class A:
class B:
self.x = 2
class C:
I only wanted to show the structure of the code, not the actual
instructions.
That's not valid Python code. Do you mean:
Class A:
Class B:
x
On 10/18/2010 06:45 AM, f...@slick.airforce-one.org wrote:
Neil Ceruttine...@norwich.edu wrote:
I have a class A that contains two classes B and C:
class A:
class B:
self.x = 2
class C:
I only wanted to show the structure of the code, not the actual
instructions.
That's not
Gary Herron gher...@islandtraining.com wrote:
Well, your code still doesn't make sense, but the generic answers are:
I'll clarify what I need then:
I'm drawing Bézier curves. I draw them on a zone that is defined as a
subclass of GtkDrawingArea.
In a zone, I define a system of coordinates by 4
f...@slick.airforce-one.org wrote:
Neil Cerutti ne...@norwich.edu wrote:
I have a class A that contains two classes B and C:
class A:
class B:
self.x = 2
class C:
I only wanted to show the structure of the code, not the actual
instructions.
Always post working
Jean-Michel Pichavant jeanmic...@sequans.com wrote:
Always post working code, or at least something we can paste in the
python interpreter (even if it's buggy)
Ok, noted.
class A:
class B:
x=2
class C:
def __init__(self):
print A.B.x
c = A.C()
2
On Mon, 18 Oct 2010 14:35:58 +, fab wrote:
So my way of coding it is the following:
class zone(GtkDrawingArea):
class systemOfCoordinates:
self.xmin = -5
self.xmax = 5
self.ymin = -5
self.ymax = 5
self isn't meaningful within a class definition.
It's far from
Am 18.10.2010 16:35, schrieb f...@slick.airforce-one.org:
So my way of coding it is the following:
class zone(GtkDrawingArea):
class systemOfCoordinates:
self.xmin = -5
self.xmax = 5
self.ymin = -5
self.ymax = 5
class Curve:
self.listOfPoints = ()
def
Christian Heimes li...@cheimes.de wrote:
Don't nest classes. Just don't. This might be a valid and good approach
in some programming languages but it's not Pythonic. Your code can
easily be implemented without nested classes.
I think you're right. It would have been more aesthetically pleasant
On Mon, 18 Oct 2010 17:17:52 +0200 Christian Heimes li...@cheimes.de
wrote:
[snip]
Don't nest classes. Just don't. This might be a valid and good
approach in some programming languages but it's not Pythonic.
Explain!
/W
--
To reach me via email, replace INVALID with the country code of my
f...@slick.airforce-one.org wrote:
Christian Heimes li...@cheimes.de wrote:
Don't nest classes. Just don't. This might be a valid and good approach
in some programming languages but it's not Pythonic. Your code can
easily be implemented without nested classes.
I think you're right. It
On Mon, Oct 18, 2010 at 8:58 AM, Andreas Waldenburger
use...@geekmail.invalid wrote:
On Mon, 18 Oct 2010 17:17:52 +0200 Christian Heimes li...@cheimes.de
wrote:
[snip]
Don't nest classes. Just don't. This might be a valid and good
approach in some programming languages but it's not Pythonic.
f...@slick.airforce-one.org wrote:
Jean-Michel Pichavant jeanmic...@sequans.com wrote:
Always post working code, or at least something we can paste in the
python interpreter (even if it's buggy)
Ok, noted.
class A:
class B:
x=2
class C:
def __init__(self):
On 10/18/2010 8:17 AM, Christian Heimes wrote:
Am 18.10.2010 16:35, schrieb f...@slick.airforce-one.org:
So my way of coding it is the following:
class zone(GtkDrawingArea):
class systemOfCoordinates:
self.xmin = -5
self.xmax = 5
self.ymin = -5
self.ymax = 5
class
On Mon, 18 Oct 2010 17:17:52 +0200, Christian Heimes wrote:
Don't nest classes. Just don't. This might be a valid and good approach
in some programming languages but it's not Pythonic. Your code can
easily be implemented without nested classes.
I'll accept that nested classes are unusual, but
On Mon, 18 Oct 2010 09:34:07 -0700, Chris Rebert wrote:
Also, Python's scoping rules, particularly for class-level scopes, don't
work the way programmers from languages where nested classes are common
would expect:
[snip example]
I'm sorry, I don't see that language Foo programmers will be
On Mon, 18 Oct 2010 09:34:07 -0700, Chris Rebert wrote:
Also, Python's scoping rules, particularly for class-level scopes, don't
work the way programmers from languages where nested classes are common
would expect:
[snip example]
I'm sorry, I don't see that language Foo programmers will be
On Mon, 18 Oct 2010 09:34:07 -0700, Chris Rebert wrote:
Also, Python's scoping rules, particularly for class-level scopes, don't
work the way programmers from languages where nested classes are common
would expect:
[snip example]
I'm sorry, I don't see that language Foo programmers will be
On Mon, 18 Oct 2010 09:34:07 -0700, Chris Rebert wrote:
Also, Python's scoping rules, particularly for class-level scopes, don't
work the way programmers from languages where nested classes are common
would expect:
[snip example]
I'm sorry, I don't see that language Foo programmers will be
On Mon, 18 Oct 2010 09:34:07 -0700, Chris Rebert wrote:
Also, Python's scoping rules, particularly for class-level scopes, don't
work the way programmers from languages where nested classes are common
would expect:
[snip example]
I'm sorry, I don't see that language Foo programmers will be
On Mon, 18 Oct 2010 09:34:07 -0700, Chris Rebert wrote:
Also, Python's scoping rules, particularly for class-level scopes, don't
work the way programmers from languages where nested classes are common
would expect:
[snip example]
I'm sorry, I don't see that language Foo programmers will be
On Mon, 18 Oct 2010 09:34:07 -0700, Chris Rebert wrote:
Also, Python's scoping rules, particularly for class-level scopes, don't
work the way programmers from languages where nested classes are common
would expect:
[snip example]
I'm sorry, I don't see that language Foo programmers will be
On Mon, 18 Oct 2010 09:34:07 -0700, Chris Rebert wrote:
Also, Python's scoping rules, particularly for class-level scopes, don't
work the way programmers from languages where nested classes are common
would expect:
[snip example]
I'm sorry, I don't see that language Foo programmers will be
On Mon, 18 Oct 2010 09:34:07 -0700, Chris Rebert wrote:
Also, Python's scoping rules, particularly for class-level scopes, don't
work the way programmers from languages where nested classes are common
would expect:
[snip example]
I'm sorry, I don't see that language Foo programmers will be
On Mon, 18 Oct 2010 09:34:07 -0700, Chris Rebert wrote:
Also, Python's scoping rules, particularly for class-level scopes, don't
work the way programmers from languages where nested classes are common
would expect:
[snip example]
I'm sorry, I don't see that language Foo programmers will be
In article 4cbcca47$0$29979$c3e8da3$54964...@news.astraweb.com,
Steven D'Aprano st...@remove-this-cybersource.com.au wrote:
I'm sorry, I don't see that language Foo programmers will be surprised
that Python is not language Foo is an argument against Python
programmers using nested classes.
On 2010-10-18, Aahz a...@pythoncraft.com wrote:
In article 4cbcca47$0$29979$c3e8da3$54964...@news.astraweb.com,
Steven D'Aprano st...@remove-this-cybersource.com.au wrote:
[duplicate post]
Maybe, but there's no reason for posting that ten times! ;-)
I would guess that there is almost
On Mon, 18 Oct 2010 16:05:04 -0700, Aahz wrote:
In article 4cbcca47$0$29979$c3e8da3$54964...@news.astraweb.com, Steven
D'Aprano st...@remove-this-cybersource.com.au wrote:
I'm sorry, I don't see that language Foo programmers will be surprised
that Python is not language Foo is an argument
Steven D'Aprano st...@remove-this-cybersource.com.au wrote:
I'll accept that nested classes are unusual, but unPythonic? Never!
Not even if flat is better than nested ;)
And are you the same Steven D'Aprano who once wrote:
Never nest classes, unless you need to, or to win a bet.
Given that
On Tue, Oct 19, 2010 at 1:37 PM, alex23 wuwe...@gmail.com wrote:
Given that there's little if anything gained from nesting classes
(other than possible scoping confusion) is there ever a need?
15+ years of programming and I've never used nested classes in any language :)
cheers
James
--
--
On Tue, 19 Oct 2010 13:54:32 +1000, James Mills wrote:
On Tue, Oct 19, 2010 at 1:37 PM, alex23 wuwe...@gmail.com wrote:
Given that there's little if anything gained from nesting classes
(other than possible scoping confusion) is there ever a need?
15+ years of programming and I've never
On Mon, Oct 18, 2010 at 3:24 PM, Steven D'Aprano
st...@remove-this-cybersource.com.au wrote:
On Mon, 18 Oct 2010 09:34:07 -0700, Chris Rebert wrote:
Also, Python's scoping rules, particularly for class-level scopes, don't
work the way programmers from languages where nested classes are common
On Mon, 18 Oct 2010 20:37:34 -0700, alex23 wrote:
Steven D'Aprano st...@remove-this-cybersource.com.au wrote:
I'll accept that nested classes are unusual, but unPythonic? Never!
Not even if flat is better than nested ;)
But Namespaces are one honking great idea -- let's do more of
those!
37 matches
Mail list logo