Re: [Tutor] lazy? vs not lazy? and yielding

2010-03-04 Thread spir
On Thu, 4 Mar 2010 21:57:18 +0100 Andreas Kostyrka wrote: I would rather write it: > x_it = iter(x) # get an iterator for x > try: > while True: >i = x_it.next() >print i > except StopIteration: > pass x_it = iter(x) # get an iterator for x while True: try:

Re: [Tutor] Encoding

2010-03-04 Thread Dave Angel
Giorgio wrote: 2010/3/4 spir Ok,so you confirm that: s = u"ciao è ciao" will use the file specified encoding, and that t = "ciao è ciao" t = unicode(t) Will use, if not specified in the function, ASCII. It will ignore the encoding I specified on the top of the file. right? A literal

Re: [Tutor] Understanding (Complex) Modules

2010-03-04 Thread Steven D'Aprano
On Thu, 4 Mar 2010 12:24:35 pm Wayne Watson wrote: > First a little preamble before my questions. > > Most of my work in Python has required modifying a program that uses > modules that were imported by the original program. I've made some > use of modules on a command line like math, and have used

Re: [Tutor] object representation

2010-03-04 Thread Steven D'Aprano
On Thu, 4 Mar 2010 06:47:04 pm spir wrote: > Hello, > > In python like in most languages, I guess, objects (at least > composite ones -- I don't know about ints, for instance -- someone > knows?) are internally represented as associative arrays. No. You can consider a Python object to be someth

Re: [Tutor] object representation

2010-03-04 Thread Steven D'Aprano
On Fri, 5 Mar 2010 01:22:52 am Dave Angel wrote: > spir wrote: [...] > > PS: Would someone point me to typical hash funcs for string keys, > > and the one used in python? > > http://effbot.org/zone/python-hash.htm But note that this was written a few years ago, and so may have been changed. As f

Re: [Tutor] lazy? vs not lazy? and yielding

2010-03-04 Thread Steven D'Aprano
On Fri, 5 Mar 2010 07:57:18 am Andreas Kostyrka wrote: > > A list comprehension builds a whole list at one time. So if the > > list needed is large enough in size, it'll never finish, and > > besides, you'll run out of memory and crash. A generator > > expression builds a function instead which

Re: [Tutor] lazy? vs not lazy? and yielding

2010-03-04 Thread Andreas Kostyrka
Am Mittwoch, 3. März 2010 21:41:34 schrieb Dave Angel: > John wrote: > > Hi, > > > > I just read a few pages of tutorial on list comprehenion and generator > > expression. From what I gather the difference is "[ ]" and "( )" at the > > ends, better memory usage and the something the tutorial label

[Tutor] WSGI / Apache

2010-03-04 Thread Giorgio
Hi, as you all probably know i'm using the Google App Engine platform for my python code. As I learn python i try to understand more and more how GAE works. Today i've noticed that all applications on GAE are running on WSGI. A quick Google search told me that WSGI is a new standard for web appli

Re: [Tutor] Encoding

2010-03-04 Thread Giorgio
2010/3/4 spir > > > How do you know your win XP terminal is configured to deal with text using > utf8? Why do you think it should? > I think there is an option in IDLE configuration to set this. So, if my entire system is not utf8 i can't use the IDLE for this test? > > This trial uses the def

Re: [Tutor] Encoding

2010-03-04 Thread spir
On Thu, 4 Mar 2010 15:13:44 +0100 Giorgio wrote: > Thankyou. > > You have clarificated many things in those emails. Due to high numbers of > messages i won't quote everything. > > So, as i can clearly understand reading last spir's post, python gets > strings encoded by my editor and to convert

Re: [Tutor] object representation

2010-03-04 Thread Dave Angel
spir wrote: Hello, In python like in most languages, I guess, objects (at least composite ones -- I don't know about ints, for instance -- someone knows?) are internally represented as associative arrays. Python associative arrays are dicts, which in turn are implemented as hash tables. Corre

Re: [Tutor] Encoding

2010-03-04 Thread Giorgio
Thankyou. You have clarificated many things in those emails. Due to high numbers of messages i won't quote everything. So, as i can clearly understand reading last spir's post, python gets strings encoded by my editor and to convert them to unicode i need to specify HOW they're encoded. This make

Re: [Tutor] unittest

2010-03-04 Thread Steven D'Aprano
On Thu, 4 Mar 2010 05:32:22 pm you wrote: > Steven D'Aprano wrote: > > On Thu, 4 Mar 2010 04:27:23 am C.T. Matsumoto wrote: > >> Hello, > >> > >> Can someone tell me the difference between unittests assertEqual > >> and assertEquals? > > > > assertEqual, assertEquals and failUnless are three spelli

Re: [Tutor] Encoding

2010-03-04 Thread Albert-Jan Roskam
Hi,   For everybody who's having trouble understanding encoding, I found this page useful: http://evanjones.ca/python-utf8.html Cheers!! Albert-Jan ~~ In the face of ambiguity, refuse the temptation to guess. ~~~

Re: [Tutor] lazy? vs not lazy? and yielding

2010-03-04 Thread spir
On Wed, 03 Mar 2010 15:41:34 -0500 Dave Angel wrote: > John wrote: > > Hi, > > > > I just read a few pages of tutorial on list comprehenion and generator > > expression. From what I gather the difference is "[ ]" and "( )" at the > > ends, better memory usage and the something the tutorial lab

Re: [Tutor] Python tutor

2010-03-04 Thread Alan Gauld
"Nicholas Hatzopoulos" wrote Hi my name is Nicholas and i just started with the basics on python 3.1. I will be starting research work on stars spectral analysis and graphics and i would like to know if anybody can please help me and tutor me in private or in groups. The mailing list is the g

Re: [Tutor] object representation

2010-03-04 Thread Alan Gauld
"spir" wrote Does this mean that the associative arrays representing objects are implemented like python dicts, thus hash tables? Yes, in fact I think they are Python dicts - although I've never actually looked at the source to confirm that. I was wondering about the question because I gue

[Tutor] Python tutor

2010-03-04 Thread Nicholas Hatzopoulos
Hi my name is Nicholas and i just started with the basics on python 3.1. I will be starting research work on stars spectral analysis and graphics and i would like to know if anybody can please help me and tutor me in private or in groups. Thank you. _