Re: [Tutor] Question on "import foobar" vs "from foobar import *"

2010-01-09 Thread Lowell Tackett
If I might offer one small comment... It seems to me that this argument also goes to a code readability issue; ergo, if you choose "from foobar..." as opposed to "import foobar", then from that point on you only need employ foobar's methods in your code, and they are not alway easily recognizab

Re: [Tutor] question about function inside of function

2010-01-09 Thread Richard D. Moores
On Sat, Jan 9, 2010 at 07:28, Alan Gauld wrote: > > "Richard D. Moores" wrote >> >> to be put in a function. For convenience sake, I've put this new >> function inside the one that calls it. >> >> Question 1: Is this bad practice? It works fine that way, but.. > > No, but there are some issues to

Re: [Tutor] Expanding a Python script to include a zcat and awk pre-process

2010-01-09 Thread Dave Angel
galaxywatc...@gmail.com wrote: After many more hours of reading and testing, I am still struggling to finish this simple script, which bear in mind, I already got my desired results by preprocessing with an awk one-liner. I am opening a zipped file properly, so I did make some progress, but

Re: [Tutor] Expanding a Python script to include a zcat and awk pre-process

2010-01-09 Thread galaxywatcher
I finally got it working! I would do a victory lap around my apartment building if I wasn't recovering from a broken ankle. Excuse my excitement, but this simple script marks a new level of Python proficiency for me. Thanks to Kent, Bob, Denis, and others who pointed me in the right directi

[Tutor] Hooray! I finished the 'Learning Python for absolute beginners'

2010-01-09 Thread Tim Goddard
Ok, it's not a big deal, but once I learned enough I went off on a few tangents to create programs of my own design. Since I had to return the book to the public library, I finally got back to finishing the last chapter. Since the book is not current, I took the time to decipher the differences a

Re: [Tutor] Hooray! I finished the 'Learning Python for absolute beginners'

2010-01-09 Thread Eddie
Nice one... I should still get to starting lol... 2010/1/10 Tim Goddard > Ok, it's not a big deal, but once I learned enough I went off on a few > tangents to create programs of my own design. Since I had to return > the book to the public library, I finally got back to finishing the > last cha

Re: [Tutor] Hooray! I finished the 'Learning Python for absolutebeginners'

2010-01-09 Thread Alan Gauld
"Tim Goddard" wrote I also figured out how to configure Eclipse IDE to recognize modules. Apparently in the preferences for each 'project' is a separate PYTHONPATH.. which is not to be confused with sys.path. Adding the appropriate folders to the preferences allows the user to browse through

Re: [Tutor] Question on "import foobar" vs "from foobar import *"

2010-01-09 Thread Eric Pavey
I should add (that as I understand it), when you do a 'from foo import blah', or 'from foo import *', this is doing a *copy* (effectively) of that module's attributes into the current namespace. Doing "import foo" or "import foo as goo" is keeping a *reference *to the imported module rather than a

Re: [Tutor] Question on "import foobar" vs "from foobar import *"

2010-01-09 Thread bob gailer
Eric Pavey wrote: I should add (that as I understand it), when you do a 'from foo import blah', or 'from foo import *', this is doing a /copy/ (effectively) of that module's attributes into the current namespace. Not a copy (which means duplicating the attribute) but a new reference to the orig

Re: [Tutor] Question on "import foobar" vs "from foobar import *"

2010-01-09 Thread Lie Ryan
On 1/10/2010 11:23 AM, Eric Pavey wrote: I should add (that as I understand it), when you do a 'from foo import blah', or 'from foo import *', this is doing a /copy/ (effectively) of that module's attributes into the current namespace. Doing "import foo" or "import foo as goo" is keeping a /refe

Re: [Tutor] Question on "import foobar" vs "from foobar import *"

2010-01-09 Thread spir
Lie Ryan dixit: > only use "from module import *" if the > module was designed for such use In most cases, this translates to: the imported module defines __names__, which holds the list of names (of the objects) to be exported. Check it. Below, a,b,c,f,g,X,Y are defined, but only c,g,Y are ex

Re: [Tutor] formatting*

2010-01-09 Thread Alan Gauld
"Lowell Tackett" wrote In the meantime, posing this query took me somewhere I hadn't imagined... I got turned on to the 'Gmane' mailsite, which pretty much solved all my issues, plus presented a much nicer 'reading room'. I actually use it as a news feed into Outlook Express. I only occasi

[Tutor] question about function inside of function

2010-01-09 Thread Richard D. Moores
I'm working on a function that seems to cry out for some of its code to be put in a function. For convenience sake, I've put this new function inside the one that calls it. Question 1: Is this bad practice? It works fine that way, but.. Question 2: If the answer to Q1 is no, is there a standard p

[Tutor] (no subject)

2010-01-09 Thread sudhir prasad
hi, iam a beginner. sample_file = file("/home/ee08m082/Desktop/python/123.txt","w") sample_file.write("About Pythons\n") in the above two line code,123.txt is being created but "About Pythons" is not being written in the file. my OS is redhat linux and python version is 2.3.4 thanks __

Re: [Tutor] (no subject)

2010-01-09 Thread Dave Angel
sudhir prasad wrote: hi, iam a beginner. sample_file = file("/home/ee08m082/Desktop/python/123.txt","w") sample_file.write("About Pythons\n") in the above two line code,123.txt is being created but "About Pythons" is not being written in the file. my OS is redhat linux and python version is 2

Re: [Tutor] Expanding a Python script to include a zcat and awk pre-process

2010-01-09 Thread galaxywatcher
After many more hours of reading and testing, I am still struggling to finish this simple script, which bear in mind, I already got my desired results by preprocessing with an awk one-liner. I am opening a zipped file properly, so I did make some progress, but simply assigning num1 and num2

Re: [Tutor] question about function inside of function

2010-01-09 Thread spir
Richard D. Moores dixit: > I'm working on a function that seems to cry out for some of its code > to be put in a function. For convenience sake, I've put this new > function inside the one that calls it. > > Question 1: Is this bad practice? It works fine that way, but.. > > Question 2: If the a

Re: [Tutor] question about function inside of function

2010-01-09 Thread Richard D. Moores
On Sat, Jan 9, 2010 at 05:03, spir wrote: > Do you realize the inner func will be redefined before each call? Oh, I forgot about that. Thanks! Dick ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.pyth

Re: [Tutor] Question on "import foobar" vs "from foobar import *"

2010-01-09 Thread Alan Gauld
"Rob Cherry" wrote Extending on this advice somewhat - is it *ever* correct to "import foobar". Yes, it is *usually* correct to "import foobar" and rarely correct to "from foobar". The exception being if you only need one or two names from foobar, but usually you need a lot more, in which

Re: [Tutor] question about function inside of function

2010-01-09 Thread Alan Gauld
"Richard D. Moores" wrote to be put in a function. For convenience sake, I've put this new function inside the one that calls it. Question 1: Is this bad practice? It works fine that way, but.. No, but there are some issues to consider. Denis has addressed some but one other is... Reuse:

[Tutor] cookielib and form authentication woes

2010-01-09 Thread Matt Ball
dear tutors, I'm trying to use a GPS tracking service called InstaMapper. The service changes how frequently it updates the tracking device's position based on whether the UI is being accessed on the InstaMapper webpage. I'd like to have the increased update frequency happen all the time so I th