Re: Classes and functions.

2008-09-26 Thread Terry Reedy
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

Re: classes and functions

2007-03-05 Thread Gabriel Genellina
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

Re: classes and functions

2007-03-03 Thread Arnaud Delobelle
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

Re: classes and functions

2007-03-03 Thread James Stroud
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

Re: classes and functions

2007-03-02 Thread Thomas Dybdahl Ahle
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

Re: classes and functions

2007-03-02 Thread Nicholas Parsons
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

Re: classes and functions

2007-03-02 Thread Bruno Desthuilliers
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

Re: Classes and Functions - General Questions

2006-10-19 Thread Sybren Stuvel
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

Re: Classes and Functions - General Questions

2006-10-19 Thread John Salerno
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

Re: Classes and Functions - General Questions

2006-10-18 Thread Setash
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

Re: Classes and Functions - General Questions

2006-10-18 Thread Andreas Hartl
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

Re: Classes and Functions - General Questions

2006-10-18 Thread John Salerno
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

Re: Classes and Functions - General Questions

2006-10-18 Thread Bruno Desthuilliers
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 do you extend classes? > > I know its a

Re: Classes and Functions - General Questions

2006-10-18 Thread John Salerno
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

Re: Classes and Functions - General Questions

2006-10-18 Thread Setash
> > > > 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

Re: Classes and Functions - General Questions

2006-10-18 Thread Sybren Stuvel
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'