[Tutor] Problem importing modules.

2013-06-02 Thread Shreyas Prakash
I am using Python 2.7 I tried importing a module named hello.py I got this error message Traceback (most recent call last): File "", line 1, in import hello ImportError: No module named hello I am not sure why, Can you please give me more insight about the proper syntax and the PYTHONPATH direc

Re: [Tutor] when is a generator "smart?"

2013-06-02 Thread Jim Mooney
On 2 June 2013 20:33, eryksun wrote: > > The base sys.path configured in the registry already has lib-tk: > > C:\>reg query hklm\software\python\pythoncore\2.7\pythonpath > > HKEY_LOCAL_MACHINE\software\python\pythoncore\2.7\pythonpath > (Default)REG_SZ > C:\Python27\L

Re: [Tutor] when is a generator "smart?"

2013-06-02 Thread eryksun
On Sun, Jun 2, 2013 at 11:33 PM, eryksun wrote: > In 3.3, it was reorganized into the tkinter package Sorry, that should have been 3.x. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman

Re: [Tutor] when is a generator "smart?"

2013-06-02 Thread Steven D'Aprano
On 03/06/13 12:50, Jim Mooney wrote: In regard to that, I just tried importing Tkinter, according to a guide I'm using. Except the guide is using tkinter and not Tkinter, but Py27 has Tkinter. Lord knows why they bothered to change one lousy letter - it would be less confusing to have given it a

Re: [Tutor] when is a generator "smart?"

2013-06-02 Thread eryksun
On Sun, Jun 2, 2013 at 10:50 PM, Jim Mooney wrote: > In regard to that, I just tried importing Tkinter, according to a > guide I'm using. Except the guide is using tkinter and not Tkinter, > but Py27 has Tkinter. Lord knows why they bothered to change one lousy > letter - it would be less confusin

Re: [Tutor] when is a generator "smart?"

2013-06-02 Thread Jim Mooney
On 2 June 2013 17:23, Marc Tompkins wrote: > > I saw a quote a long time ago; I'd love to attribute it properly, but...: > "God created the world in just seven days. But then, He had no installed > base." Using Python 2.7 on Windows 7 In regard to that, I just tried importing Tkinter, according

Re: [Tutor] when is a generator "smart?"

2013-06-02 Thread Marc Tompkins
On Sun, Jun 2, 2013 at 9:56 AM, Jim Mooney wrote: > I still sometimes type input instead of that annoying raw_input and get a > weird error. Here's a nifty tip to get around that - and to eliminate one more thing you'd have to change later, if you switch back to 3. Put this near the top of yo

Re: [Tutor] when is a generator "smart?"

2013-06-02 Thread Jim Mooney
On 2 June 2013 03:39, Dave Angel wrote: > On 06/01/2013 11:58 PM, Jim Mooney wrote: > I'm astounded nobody has asked you what version of Python this is for. in > Python 2.x, the range(x,y) function produces the whole list, and then the > expression around it converts that to a generator. That al

Re: [Tutor] when is a generator "smart?"

2013-06-02 Thread eryksun
On Sat, Jun 1, 2013 at 11:58 PM, Jim Mooney wrote: > > def uneven_squares(x,y): > squarelist = (c**2 for c in range(x,y) if c%2 != 0) > return squarelist #returning a generator > > print(list(uneven_squares(10,1))[2:10]) #slows as y gets bigger, then dies I think you said you switched

Re: [Tutor] when is a generator "smart?"

2013-06-02 Thread Steven D'Aprano
On 02/06/13 13:58, Jim Mooney wrote: def uneven_squares(x,y): squarelist = (c**2 for c in range(x,y) if c%2 != 0) return squarelist #returning a generator By the way, I should mention that there are better ways to write this. Or at least different :-) To start with, the *generator

Re: [Tutor] when is a generator "smart?"

2013-06-02 Thread Dave Angel
On 06/01/2013 11:58 PM, Jim Mooney wrote: It's a little unclear to me where generators are more efficient. I'm astounded nobody has asked you what version of Python this is for. in Python 2.x, the range(x,y) function produces the whole list, and then the expression around it converts that to