On 18 Oct 2010 22:29:27 GMT Steven D'Aprano
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 would expect:
> [snip exampl
Steven D'Aprano 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
consenting adults' ethos as well.
> There'
On Mon, 18 Oct 2010 20:37:34 -0700, alex23 wrote:
> Steven D'Aprano 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!" (classes are a good thing) an
On Mon, Oct 18, 2010 at 3:24 PM, Steven D'Aprano
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
>> would expect:
> [snip exampl
On Tue, 19 Oct 2010 13:54:32 +1000, James Mills wrote:
> On Tue, Oct 19, 2010 at 1:37 PM, alex23 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 cl
On Tue, Oct 19, 2010 at 1:37 PM, alex23 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
--
-- James Mills
--
--
Steven D'Aprano 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 there's little if anything gained
On Mon, 18 Oct 2010 16:05:04 -0700, Aahz wrote:
> In article <4cbcca47$0$29979$c3e8da3$54964...@news.astraweb.com>, Steven
> D'Aprano 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
On 2010-10-18, Aahz wrote:
> In article <4cbcca47$0$29979$c3e8da3$54964...@news.astraweb.com>,
> Steven D'Aprano wrote:
>>[duplicate post]
> Maybe, but there's no reason for posting that ten times! ;-)
I would guess that there is almost certainly a reason. My first candidate
would be "buggy
In article <4cbcca47$0$29979$c3e8da3$54964...@news.astraweb.com>,
Steven D'Aprano 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. Surely it's an argument against
>w
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 b
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 b
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 b
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 b
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 b
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 b
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 b
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 b
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 b
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 b
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, b
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 Cu
f...@slick.airforce-one.org wrote:
Jean-Michel Pichavant 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
On Mon, Oct 18, 2010 at 8:58 AM, Andreas Waldenburger
wrote:
> On Mon, 18 Oct 2010 17:17:52 +0200 Christian Heimes
> 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!
"Private" classe
f...@slick.airforce-one.org wrote:
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 think you're right. It would have been
On Mon, 18 Oct 2010 17:17:52 +0200 Christian Heimes
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 home
country
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 think you're right. It would have been more aesthetically pleasant
to me (a Hand
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 = ()
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 f
Jean-Michel Pichavant 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
Good, thanks.
f...@slick.airforce-one.org wrote:
Neil Cerutti 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 code, or at least some
Gary Herron 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 values: xmin, xmax,
ymin,
On 10/18/2010 06:45 AM, f...@slick.airforce-one.org wrote:
Neil Cerutti 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. D
Neil Cerutti 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:
>
On 2010-10-18, Neil Cerutti wrote:
> On 2010-10-18,
> 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
On 2010-10-18,
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:
Class A:
Class B:
x = 2
or
Class A
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
37 matches
Mail list logo