[Tutor] Introducing myself.

2013-05-13 Thread Natal Ngétal
Hi, I'm new to the mailing list, I think it is interesting to present. I'm a developer, I use Python and Perl yes it is also a great language. I use Python to work, but I also love the language for its simplicity, its community, and its clean syntax. Lacks a more advanced pypi like CPAN, that pars

Re: [Tutor] creating a corpus from a csv file

2013-05-13 Thread Treder, Robert
Message: 1 Date: Fri, 03 May 2013 23:05:32 +0100 From: Alan Gauld To: tutor@python.org Subject: Re: [Tutor] creating a corpus from a csv file Message-ID: Content-Type: text/plain; charset=ISO-8859-1; format=flowed On 03/05/13 21:48, Treder, Robert wrote: > I'm very new to python and am trying

Re: [Tutor] Introducing myself.

2013-05-13 Thread Alan Gauld
On 13/05/13 13:36, Natal Ngétal wrote: Welcome, Otherwise, I am registered on the ml to help if I can, and I'd also like to know the kind of question that can be asked, or stops the beginner level, because I think remain an eternal beginner. The audience of the list is people learning Python.

Re: [Tutor] Introducing myself.

2013-05-13 Thread Natal Ngétal
On 05/13/13 16:36, Alan Gauld wrote: > The audience of the list is people learning Python. It is > deliberately open ended, you decide when you are no longer a > beginner :-) Ok thanks for your response. As said, I think being a beginner eternal. > We cover the Python language, idioms and the stan

[Tutor] First Python module I publish.

2013-05-13 Thread Natal Ngétal
Hi, Sorry for this little pub, some time ago that I published my first Python module on pypi. This is a port of a Perl module is a very simple text localization system. I am very happy to have your opinion, ideas and feedback. I have also a question I use % for the display of the chain, but I thin

[Tutor] under, under

2013-05-13 Thread Stafford Baines
Please explain the significance of __some term__. For example __name__ as in If __name__ == '__main__': main() When is the under, under used? Regards, Stafford ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscripti

Re: [Tutor] under, under

2013-05-13 Thread Natal Ngétal
On 05/13/13 17:21, Stafford Baines wrote: > When is the under, under used? It depends the context, for example __name__ represent the name of the current package. The __init__ it's object methode to initialize the object, and so on. -- \0/ Hobbestigrou site web: erakis.eu L'Europe est trop grande

Re: [Tutor] under, under

2013-05-13 Thread Joel Goldstick
I have seen (and enjoy) people calling double underscore as 'Dunder' On Mon, May 13, 2013 at 12:32 PM, Natal Ngétal wrote: > On 05/13/13 17:21, Stafford Baines wrote: > > When is the under, under used? > It depends the context, for example __name__ represent the name of the > current > package.

[Tutor] under, under

2013-05-13 Thread Stafford Baines
Please explain the significance of __some term__.For example __name__ as in If __name__ == '__main__': main() When is the under, under used? Regards, Stafford ___ Tutor maillist - Tutor@python.org To unsubscribe or change subsc

Re: [Tutor] under, under

2013-05-13 Thread Dave Angel
On 05/13/2013 12:21 PM, Stafford Baines wrote: Please explain the significance of __some term__. For example __name__ as in If __name__ == '__main__': main() When is the under, under used? (Please don't start a second thread with identical content 20 minutes after the first) Undersc

Re: [Tutor] under, under

2013-05-13 Thread Jonatán Guadamuz Espinoza
On Mon, May 13, 2013 at 10:21 AM, Stafford Baines wrote: > > Please explain the significance of __some term__. For example __name__ as in > > If __name__ == ‘__main__’: > > main() > > When is the under, under used? Section 2.3.2 http://docs.python.org/3/reference/lexical_analysis.html#reserve

Re: [Tutor] under, under

2013-05-13 Thread eryksun
On Mon, May 13, 2013 at 1:18 PM, Dave Angel wrote: > Underscores aren't anything special to the Python language itself, whether > leading or trailing. I'm pretty sure you were just talking about dunder, dunder. Underscores in general do have special uses in the language. They're used to enable na

[Tutor] variable in format string throwing error

2013-05-13 Thread Jim Mooney
I'm trying variable substitution in a format string that looks like one that works, but I get an error. What am I doing wrong? tks x = 40 s = 'John flew to the {0:-^{x}} yesterday' print(s.format('moon', x)) Error is builtins.KeyError: 'x' -- Jim ___

Re: [Tutor] variable in format string throwing error

2013-05-13 Thread eryksun
On Mon, May 13, 2013 at 5:51 PM, Jim Mooney wrote: > I'm trying variable substitution in a format string that looks like one that > works, but I get an error. What am I doing wrong? tks > > x = 40 > s = 'John flew to the {0:-^{x}} yesterday' > print(s.format('moon', x)) > > Error is builtins.KeyEr

Re: [Tutor] Making a Primary Number List generator

2013-05-13 Thread Daniel Magruder
Dear Dave, I am using python 2. I am still confused as what return does. What does it mean if a function returns True to the caller? What is the caller? Your code worked for returning a list of 1000 items of odd numbers, so I then tried writing a code to replay isodd to give True or False for is

Re: [Tutor] variable in format string throwing error

2013-05-13 Thread Mark Lawrence
On 13/05/2013 22:51, Jim Mooney wrote: I'm trying variable substitution in a format string that looks like one that works, but I get an error. What am I doing wrong? tks x = 40 s = 'John flew to the {0:-^{x}} yesterday' print(s.format('moon', x)) Error is builtins.KeyError: 'x' -- Jim Using

Re: [Tutor] Making a Primary Number List generator

2013-05-13 Thread Alan Gauld
On 14/05/13 00:01, Daniel Magruder wrote: I am still confused as what return does. > What does it mean if a function returns True to the caller? > What is the caller? The caller is the program code that calls the function. For example if I write a function def square(x): return x*x and w

Re: [Tutor] Making a Primary Number List generator

2013-05-13 Thread Marc Tompkins
On Mon, May 13, 2013 at 4:01 PM, Daniel Magruder wrote: > Dear Dave, > I am using python 2. > I am still confused as what return does. What does it mean if a function > returns True to the caller? What is the caller? > You've defined a function - isodd - but it doesn't automatically execute. It

Re: [Tutor] Making a Primary Number List generator

2013-05-13 Thread Marc Tompkins
On Mon, May 13, 2013 at 5:13 PM, Marc Tompkins wrote: > In fact, you could shorten your isodd() function to: > > def isodd(candidate): > >return candidate%2 !=0: > and it would function identically. > Sorry - that should be > def isodd(candidate): >return candidate%2 !=0 _

Re: [Tutor] Making a Primary Number List generator

2013-05-13 Thread Dave Angel
On 05/13/2013 07:01 PM, Daniel Magruder wrote: Dear Dave, I am using python 2. I am still confused as what return does. What does it mean if a > function returns True to the caller? What is the caller? Have you ever used (called) a function? If so, you've written a caller. For example, if

Re: [Tutor] under, under

2013-05-13 Thread Steven D'Aprano
On 14/05/13 02:21, Stafford Baines wrote: Please explain the significance of __some term__. For example __name__ as in If __name__ == '__main__': main() When is the under, under used? Underscores are legal characters in names. So you can write: some_term = whatever() and it is a le

Re: [Tutor] Making a Primary Number List generator

2013-05-13 Thread Dave Angel
On 05/13/2013 07:55 PM, Alan Gauld wrote: On 14/05/13 00:01, Daniel Magruder wrote: That seems OK but it would be simpler with a for loop: def counting_primes(): primelist = [] for prime in range(2,1000): if isprime(prime): primelist.append(prime) return pr

Re: [Tutor] Making a Primary Number List generator

2013-05-13 Thread Dave Angel
(Please don't top-post. And don't reply privately, as I'm not the only one reading this thread. Post the reply to the list, as you did last time with your reply-all) On 05/13/2013 09:45 PM, Daniel Magruder wrote: Dear Dave, I don't have a clue what you're confused about. Do you not unders