[Tutor] command line invocation

2010-01-17 Thread Robert
Say that I have module "spam.py" in "/tmp" which is in PYTHONPATH. in shell, my current directory is "/tmp", are line#3 and #4 --- http://paste.pocoo.org/show/166268/ - "equivalent" --- i.e. yielding the same result ? Thanks ___ Tutor maillist - Tut

Re: [Tutor] Confirmation about __init__()

2010-01-17 Thread Alan Gauld
"Robert" wrote I have read quite a bit in the past 2 months, ( I have also looked at codes) At this point, I think I understand well what __init__() is and does - But, I have yet to see this *specifically* spelled out about the the __init__ method for a Class; It is OPTIONAL, correct ? Yes

Re: [Tutor] command line invocation

2010-01-17 Thread Alan Gauld
"Robert" wrote in shell, my current directory is "/tmp", are line#3 and #4 --- http://paste.pocoo.org/show/166268/ - "equivalent" --- i.e. yielding the same result ? No need to use pastebin when its only 2 lines! Since -m runs a module as a script I think the answer is yes. Where they wo

[Tutor] Confirmation about __init__()

2010-01-17 Thread Robert
I have read quite a bit in the past 2 months, ( I have also looked at codes) At this point, I think I understand well what __init__() is and does - But, I have yet to see this *specifically* spelled out about the the __init__ method for a Class; It is OPTIONAL, correct ? if I have NO start values

[Tutor] Subclassing object

2010-01-17 Thread Timo Vanwynsberghe
I read that it is advised to subclass object. Is it really necessary? I mean, everything works, why should I add it to my code? Cheers, Timo ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/ma

Re: [Tutor] Subclassing object

2010-01-17 Thread Alan Gauld
"Timo Vanwynsberghe" wrote I read that it is advised to subclass object. Is it really necessary? I mean, everything works, why should I add it to my code? In older versions of Python it made a difference whether you used object or not. Using object gave you a "new style" class which has s

[Tutor] adding more text to a file

2010-01-17 Thread Shizuha Aki
Hi, I am new to python, and i am trying to make a program that makes like a txt file database. so i have my whole program in a while True loop, it asks for information about the person and then writes the information about the person to a txt file, but i need it to be able to add more entries i

Re: [Tutor] adding more text to a file

2010-01-17 Thread Hugo Arts
On Sun, Jan 17, 2010 at 6:40 PM, Shizuha Aki wrote: > Hi, > > I am new to python, and i am trying to make a program that makes like a txt > file database. so i have my whole program in a while True loop, it asks for > information about the person and then writes the information about the > person

Re: [Tutor] adding more text to a file

2010-01-17 Thread Magnus Kriel
Hi, It is the way you open the text file in the beginning. This is from the python manual: open() returns a file object, and is most commonly used with two arguments: "open(filename, mode)". >>> f=open('/tmp/workfile', 'w') >>> print f The first argument is a string containing the filename. T

Re: [Tutor] Subclassing object

2010-01-17 Thread Robert
On Sun, Jan 17, 2010 at 12:47 PM, Robert wrote: > On Sun, Jan 17, 2010 at 11:25 AM, Alan Gauld > wrote: >> In older versions of Python it made a difference whether you used object >> or not. Using object gave you a "new style" class which has several extra >> features, without you got an "old st

Re: [Tutor] adding more text to a file

2010-01-17 Thread Steve Willoughby
Magnus Kriel wrote: > It might be that when you create a file for the first time with 'a', > that it will through an exception. So you will have to try with 'w', and > if there is an exception, you know the file does not exist and you will > have to create the file for the first time with 'w'. Tha

Re: [Tutor] adding more text to a file

2010-01-17 Thread Magnus Kriel
Thanx, you are correct. And now I know that 'a' will create a file as well. Magnus On Sun, Jan 17, 2010 at 10:34 AM, Steve Willoughby wrote: > Magnus Kriel wrote: > > It might be that when you create a file for the first time with 'a', > > that it will through an exception. So you will have to t

[Tutor] what is dynamic about "dynamic name resolution" ?

2010-01-17 Thread Robert
In the Python tutorial (highlighted here http://awurl.com/N1XvzIo2Q) What exactly is "dynamic name resolution" ? specifically what is "dynamic" about it ? thanks ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http

[Tutor] smtp project

2010-01-17 Thread Kirk Z Bailey
I am writing a script that will send an email message. This will run in a windows XP box. The box does not have a smtp server, so the script must crete not merely a smtp client to talk to a MTA, it must BE one for the duration of sending the message- then shut off, we don't need no bloody op0en

Re: [Tutor] what is dynamic about "dynamic name resolution" ?

2010-01-17 Thread wesley chun
On Sun, Jan 17, 2010 at 12:10 PM, Robert wrote: > In the Python tutorial (highlighted here http://awurl.com/N1XvzIo2Q) > > What exactly is "dynamic name resolution" ? specifically what is > "dynamic" about it ? what this means is that as your code is executing and the interpreter encounters an i

Re: [Tutor] adding more text to a file

2010-01-17 Thread wesley chun
> while True: >    name = raw_input("what is the name ") >    age = raw_input("what is the age ") > >    out_file = open("persons.txt", "w") >    out_file.write("name: ") >    out_file.write(name) >    out_file.write("\n") >    out_file.write("age: ") >    out_file.w

Re: [Tutor] smtp project

2010-01-17 Thread Kent Johnson
On Sun, Jan 17, 2010 at 3:45 PM, Kirk Z Bailey wrote: > I am writing a script that will send an email message. This will run in a > windows XP box. The box does not have a smtp server, so the script must > crete not merely a smtp client to talk to a MTA, it must BE one for the > duration of sendin

Re: [Tutor] smtp project

2010-01-17 Thread Steve Willoughby
Kent Johnson wrote: > On Sun, Jan 17, 2010 at 3:45 PM, Kirk Z Bailey > wrote: >> I am writing a script that will send an email message. This will run in a >> windows XP box. The box does not have a smtp server, so the script must >> crete not merely a smtp client to talk to a MTA, it must BE one

Re: [Tutor] smtp project

2010-01-17 Thread Alan Plum
On So, 2010-01-17 at 15:45 -0500, Kirk Z Bailey wrote: > I am writing a script that will send an email message. This will > run in a windows XP box. The box does not have a smtp server, so > the script must crete not merely a smtp client to talk to a MTA, > it must BE one for the duration of sen

Re: [Tutor] Subclassing object

2010-01-17 Thread Alan Gauld
"Robert" wrote I have been wondering about this "New-style Class" subject along this line: so, *theoretically speaking*, in EXISTING, pre-P3K code, if one changes everywhere where it's coded "class someClass()" to "class someClass(object)", it should not break the programs, right ? More co

Re: [Tutor] adding more text to a file

2010-01-17 Thread Alan Gauld
"Shizuha Aki" wrote i need it to be able to add more entries instead of just one. my code is like this: while True: name = raw_input("what is the name ") age = raw_input("what is the age ") out_file = open("persons.txt", "w") It would work if you moved the open() call ou

Re: [Tutor] adding more text to a file

2010-01-17 Thread Alan Gauld
"Magnus Kriel" wrote It might be that when you create a file for the first time with 'a', that it will through an exception. So you will have to try with 'w', and if there is an exception, you know the file does not exist and you will have to create the file for the first time with 'w'. T

[Tutor] exit handler for C extension module

2010-01-17 Thread Shuying Wang
Hi, What would be an atexit equivalent for a C extension module? When my extension module is unloaded, I would like some clean up functions to be called from an external c library. I've had a look at the C extension guide but I can't find anything like that, Thanks in advance, .S

Re: [Tutor] Confirmation about __init__()

2010-01-17 Thread Lie Ryan
On 01/17/10 16:42, Robert wrote: > I have read quite a bit in the past 2 months, ( I have also looked at codes) > At this point, I think I understand well what __init__() is and does - > But, I have yet to see this *specifically* spelled out about the the > __init__ method for a Class; > > It is O

Re: [Tutor] Book for Python and XML

2010-01-17 Thread Stefan Behnel
Григор, 15.01.2010 08:28: > Someone to have good E-book for python and XMl The existing books are rather old. You might find these interesting, though: http://effbot.org/zone/element.htm http://codespeak.net/lxml/tutorial.html http://www.nmt.edu/tcc/help/pubs/pylxml Stefan _

Re: [Tutor] exit handler for C extension module

2010-01-17 Thread Stefan Behnel
Shuying Wang, 18.01.2010 03:13: > What would be an atexit equivalent for a C extension module? When my > extension module is unloaded, I would like some clean up functions to > be called from an external c library. I've had a look at the C > extension guide but I can't find anything like that, I'm