On 2019-02-27 12:34:37 -0500, Dennis Lee Bieber wrote:
> On Tue, 26 Feb 2019 19:15:16 -0800 (PST), jf...@ms4.hinet.net declaimed the
> following:
>
> >So, may I say that the Python compiler is a multi-pass one?
>
> No... that is implementation dependent...
True, but
> The common Pyt
jf...@ms4.hinet.net於 2019年2月26日星期二 UTC+8下午4時46分04秒寫道:
> ast於 2019年2月26日星期二 UTC+8上午12時25分40秒寫道:
> > Hello
> >
> > I noticed a quirk difference between classes and functions
> >
> > >>> x=0
> > >>>
> > >>> cla
Chris Angelico於 2019年2月27日星期三 UTC+8上午11時29分04秒寫道:
> On Wed, Feb 27, 2019 at 2:21 PM wrote:
> >
> > Chris Angelico於 2019年2月27日星期三 UTC+8上午9時25分11秒寫道:
> > > On Wed, Feb 27, 2019 at 12:21 PM wrote:
> > > >
> > > > Gregory Ewing at 2019/2/27 AM 5:26:49 wrote:
> > > > > Thomas Jollans wrote:
> > > > >
On Wed, Feb 27, 2019 at 2:21 PM wrote:
>
> Chris Angelico於 2019年2月27日星期三 UTC+8上午9時25分11秒寫道:
> > On Wed, Feb 27, 2019 at 12:21 PM wrote:
> > >
> > > Gregory Ewing at 2019/2/27 AM 5:26:49 wrote:
> > > > Thomas Jollans wrote:
> > > > > I imagine there's a justification for the difference in behaviou
Chris Angelico於 2019年2月27日星期三 UTC+8上午9時25分11秒寫道:
> On Wed, Feb 27, 2019 at 12:21 PM wrote:
> >
> > Gregory Ewing at 2019/2/27 AM 5:26:49 wrote:
> > > Thomas Jollans wrote:
> > > > I imagine there's a justification for the difference in behaviour to do
> > > > with the fact that the body of a class
On Wed, Feb 27, 2019 at 12:21 PM wrote:
>
> Gregory Ewing at 2019/2/27 AM 5:26:49 wrote:
> > Thomas Jollans wrote:
> > > I imagine there's a justification for the difference in behaviour to do
> > > with the fact that the body of a class is only ever executed once, while
> > > the body of a functi
On 2/26/19, Gregory Ewing wrote:
> Thomas Jollans wrote:
>> I imagine there's a justification for the difference in behaviour to do
>> with the fact that the body of a class is only ever executed once, while
>> the body of a function is executed multiple times.
>
> I suspect there isn't any deep r
Gregory Ewing at 2019/2/27 AM 5:26:49 wrote:
> Thomas Jollans wrote:
> > I imagine there's a justification for the difference in behaviour to do
> > with the fact that the body of a class is only ever executed once, while
> > the body of a function is executed multiple times.
>
> I suspect there i
#x27;s 117 bugs in the code.
-Original Message-
From: Python-list On
Behalf Of Gregory Ewing
Sent: Tuesday, February 26, 2019 4:27 PM
To: python-list@python.org
Subject: Re: Quirk difference between classes and functions
Thomas Jollans wrote:
> I imagine there's a justification for
Thomas Jollans wrote:
I imagine there's a justification for the difference in behaviour to do
with the fact that the body of a class is only ever executed once, while
the body of a function is executed multiple times.
I suspect there isn't any deep reason for it, rather it's just
something that
On 25/02/2019 21.15, Chris Angelico wrote:
> On Tue, Feb 26, 2019 at 6:58 AM DL Neil
> wrote:
>>
>> On 26/02/19 5:25 AM, ast wrote:
>>> I noticed a quirk difference between classes and functions
>>> >>> x=0
>>> >>> class Test:
ast於 2019年2月26日星期二 UTC+8上午12時25分40秒寫道:
> Hello
>
> I noticed a quirk difference between classes and functions
>
> >>> x=0
> >>>
> >>> class Test:
> x = x+1
> print(x)
> x = x+1
> print(x)
>
On Tue, Feb 26, 2019 at 5:06 PM Gregory Ewing
wrote:
>
> Chris Angelico wrote:
> > Classes and functions behave differently. Inside a function, a name is
> > local if it's ever assigned to; but in a class, this is not the case.
>
> Actually, it is. Assigning to a
Chris Angelico wrote:
Classes and functions behave differently. Inside a function, a name is
local if it's ever assigned to; but in a class, this is not the case.
Actually, it is. Assigning to a name in a class body makes it part
of the class namespace, which is the local namespace at the
On Tue, Feb 26, 2019 at 6:58 AM DL Neil wrote:
>
> On 26/02/19 5:25 AM, ast wrote:
> > I noticed a quirk difference between classes and functions
> > >>> x=0
> > >>> class Test:
> > x = x+1
> > print(x)
> >
On 26/02/19 5:25 AM, ast wrote:
I noticed a quirk difference between classes and functions
>>> x=0
>>> class Test:
x = x+1
print(x)
x = x+1
print(x)
...
Previous code doesn't generate any errors.
x at the right of = in first "
Hello
I noticed a quirk difference between classes and functions
>>> x=0
>>>
>>> class Test:
x = x+1
print(x)
x = x+1
print(x)
1
2
>>> print(x)
0
Previous code doesn't generate any errors.
x at the right of = in fi
aditya shukla wrote:
Hello folks , i am using the newick module
http://www.daimi.au.dk/~mailund/newick.html.I am just learning to use it
and i have a question about it.
from newick.tree import parse_tree
from newick.tree import add_parent_links
from newick.tree import add_distance_from_root
Hello folks , i am using the newick module
http://www.daimi.au.dk/~mailund/newick.html.I am just learning to use it and
i have a question about it.
from newick.tree import parse_tree
from newick.tree import add_parent_links
from newick.tree import add_distance_from_root
import sys
t = parse_t
En Sat, 03 Mar 2007 17:04:33 -0300, Arnaud Delobelle
<[EMAIL PROTECTED]> escribió:
> On Mar 2, 11:01 pm, Nicholas Parsons <[EMAIL PROTECTED]>
> wrote:
>> That is the beauty of using Python. You have a choice of using
>> classes and traditional OOP techniques or sticking to top level
>> function
On Mar 2, 11:01 pm, Nicholas Parsons <[EMAIL PROTECTED]>
wrote:
> Hi Claire,
>
> That is the beauty of using Python. You have a choice of using
> classes and traditional OOP techniques or sticking to top level
> functions. For short, small scripts it would probably be overkill to
> use clas
Silver Rock wrote:
> Friends,
>
> I don´t see why using classes.. functions does everything already. I
> read the Rossum tutotial and two other already.
>
> Maybe this is because I am only writing small scripts, or some more
> serious misunderstandings of the language.
>
> Please give me a light
Den Fri, 02 Mar 2007 19:26:08 -0300 skrev Silver Rock:
> Friends,
>
> I don´t see why using classes.. functions does everything already. I
> read the Rossum tutotial and two other already.
>
> Maybe this is because I am only writing small scripts, or some more
> serious misunderstandings of the
Hi Claire,
That is the beauty of using Python. You have a choice of using
classes and traditional OOP techniques or sticking to top level
functions. For short, small scripts it would probably be overkill to
use classes. Yet the programmer still has classes in his tool chest
if he/she is
Silver Rock a écrit :
> Friends,
>
> I don´t see why using classes.. functions does everything already. I
> read the Rossum tutotial and two other already.
>
> Maybe this is because I am only writing small scripts, or some more
> serious misunderstandings of the language.
or both ?-)
If you onl
Friends,
I don´t see why using classes.. functions does everything already. I
read the Rossum tutotial and two other already.
Maybe this is because I am only writing small scripts, or some more
serious misunderstandings of the language.
Please give me a light.
thanks guys,
Claire
--
http://mai
Setash enlightened us with:
>> class1.py:
>>
>> class Class1(object):
>> pass
>>
>> class2.py:
>> import class1
This line imports class1.py and places its contents under the name
"class1".
> classes.py:
>
> class Class1
> pass
>
> class Class2(Class1)
> pass
That's co
John Salerno wrote:
> Setash wrote:
>
>> And have class2 inherit class1 without any import statements, or need
>> it be imported first?
>> Or need class1 and class2 be both declared in the same .py file if
>> there is inheritance?
>
> If the classes are in the same module, you don't need to do an
Andreas, and everyone else - thank you! I do appreciate the information
and the quick responses, this single post with <10 replies has
significantly helped my understanding level.
Thanks again!
--
http://mail.python.org/mailman/listinfo/python-list
Setash schrieb:
> 2) Function overloading - is it possible?
>
> Can I have the following code, or something which acts the same in
> python?:
>
>
> def function(a, b)
>do things
>
> def function(a, b, c)
>do things only if I get a third argument
Several ways. The simplest and often mo
Setash wrote:
> Also, I have seen the following syntax used once before, and havent
> found any documentation on it, any comments as to use, where to find
> docs, etc?:
>
> from module import x as name
> name.function()
All that does is give you a method for renaming a particularly unrul
Setash a écrit :
> I've got a tiny bit of coding background, but its not the most
> extensive.
>
> That said, I'm trying to wrap my head around python and have a couple
> questions with classes and functions.
>
> Two notable questions:
>
> 1) Classes. How d
Setash wrote:
> And have class2 inherit class1 without any import statements, or need
> it be imported first?
> Or need class1 and class2 be both declared in the same .py file if
> there is inheritance?
If the classes are in the same module, you don't need to do any
importing or qualification. I
> >
> > And have class2 inherit class1 without any import statements, or need
> > it be imported first?
>
> It needs to be imported first:
>
> class1.py:
>
> class Class1(object):
> pass
>
> class2.py:
> import class1
>
> class Class2(class1.Class1):
> pass
>
In respo
Setash enlightened us with:
> 1) Classes. How do you extend classes?
>
> I know its as easy as:
>
> class classname(a)
>do stuff
>
>
> But where does the parent class need to lie? In the same file? Can
> it lie in another .py file in the root directory?
It doesn't matter at all, as long as 'a'
I've got a tiny bit of coding background, but its not the most
extensive.
That said, I'm trying to wrap my head around python and have a couple
questions with classes and functions.
Two notable questions:
1) Classes. How do you extend classes?
I know its as easy as:
class classnam
36 matches
Mail list logo