Re: [Tutor] Naming conventions (was: Should this be a list comprehension or something?

2005-01-28 Thread Jacob S.
You're my best friend. Everyone else looves camelCase, and I hate it too. It doesn't make sense. It doesn't fit English. It doesn't fit Spanish. It doesn't fit any other language AFAIK, so why should a human (who uses spoken language) to computer interpreter use a naming convention that doesn't

Re: [Tutor] Should this be a list comprehension or something?

2005-01-28 Thread Jacob S.
Its not so much a criterion that they *should* be used that way, its just that its what they do. A list comprehension creates a list! Thats why they are called *list* comprehensions. :-) See, I'd always figured that the reason it was called a list comprehension was because the list comprehension o

Re: [Tutor] Please Help with Python Script for Xbox Media Center

2005-01-28 Thread Danny Yoo
On Fri, 28 Jan 2005, Rodney Butler wrote: > I have written a script that is designed to load when you start your > xbox, it gets a list of your music playlists then lets you select which > one to load, shuffle and play, then the script exits. What I need is > for the script to automatically sel

[Tutor] XBMC Python Script HELP! Needed

2005-01-28 Thread Rodney Butler
I have written a script that is designed to load when you start your xbox, it gets a list of your music playlists then lets you select which one to load, shuffle and play, then the script exits. What I need is for the script to automatically select the highlighted playlist if there is no user

[Tutor] Please Help with Python Script for Xbox Media Center

2005-01-28 Thread Rodney Butler
I have written a script that is designed to load when you start your xbox, it gets a list of your music playlists then lets you select which one to load, shuffle and play, then the script exits. What I need is for the script to automatically select the highlighted playlist if there is no user

RE: [Tutor] Diffing two files.

2005-01-28 Thread Ertl, John
Kent What I need to do is find what should be common and see if it really is. I have two output files...The output files will have a bunch of systems stuff then the text of interest and then a bunch more systems stuff. The systems stuff may be different for each file but the text of interest wil

Re: [Tutor] Diffing two files.

2005-01-28 Thread Kent Johnson
You don't really say what you are trying to accomplish. Do you want to identify the common text, or find the pieces that differ? If the common text is always the same and you know it ahead of time, you can just search the lines of each file to find it. If you need to identify the common part, d

Re: [Tutor] Naming conventions

2005-01-28 Thread Kent Johnson
Terry Carroll wrote: On Fri, 28 Jan 2005, Kent Johnson wrote: Separating with underscores is quite common in the Python community, actually it is the preferred spelling for library modules. So maybe you should adopt that, just to reduce the confusion when your code does have an encounter with the

[Tutor] Diffing two files.

2005-01-28 Thread Ertl, John
All, I have two text files that should contain a section of text that is the same. Luckily the section of text has a defined beginning and end. It looks like the most straightforward thing would be to read the targeted text from each file (only 50 lines or so) into lists and then compare the lis

Re: [Tutor] Control flow

2005-01-28 Thread Alan Gauld
> One way out of the top level is to call > sys.exit(1) Which works, but you need to import sys first. Using raise SystemExit avoids the need for an import. Alan G. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tu

Re: [Tutor] Control flow

2005-01-28 Thread Alan Gauld
SEveral solutions here. The best is to restructure the code a little: > def go_jogging(): > # go out and jog > return > > if not bad_weather == 'y': # where is this initially set BTW? go_jogging() else > # ask user only if weather is bad. > b = input ( "Weather is really ba

Re: [Tutor] Should this be a list comprehension or something?

2005-01-28 Thread Terry Carroll
On Fri, 28 Jan 2005, Alan Gauld wrote: > Its not so much a criterion that they *should* be used that way, > its just that its what they do. A list comprehension creates a list! > Thats why they are called *list* comprehensions. :-) See, I'd always figured that the reason it was called a list com

Re: [Tutor] Should this be a list comprehension or something?

2005-01-28 Thread Alan Gauld
> Alan, I'd never seen the criterion befor that list comprehensions should > be used to generate other lists. Its not so much a criterion that they *should* be used that way, its just that its what they do. A list comprehension creates a list! Thats why they are called *list* comprehensions. :-)

Re: [Tutor] Naming conventions

2005-01-28 Thread Terry Carroll
On Fri, 28 Jan 2005, Kent Johnson wrote: > Separating with underscores is quite common in the Python community, > actually it is the preferred spelling for library modules. So maybe you > should adopt that, just to reduce the confusion when your code does have > an encounter with the outside world

RE: [Tutor] Control flow

2005-01-28 Thread Smith, Jeff
One way out of the top level is to call sys.exit(1) -Original Message- From: Orri Ganel [mailto:[EMAIL PROTECTED] Sent: Friday, January 28, 2005 4:26 PM To: Gilbert Tsang; Tutor@python.org Subject: Re: [Tutor] Control flow Gilbert Tsang wrote: > Hi there, I have this logic that

Re: [Tutor] Should this be a list comprehension or something?

2005-01-28 Thread Alan Gauld
> I don't get this joke, but it sounds like the basis for it > would be interesting. Can you explain? After sending my last message I was browsing the Eiffel site and found an example of the IDE. Its here: http://archive.eiffel.com/eiffel/nutshell.html and you scroll down to the question: W

Re: [Tutor] Should this be a list comprehension or something?

2005-01-28 Thread Alan Gauld
> > So you've been looking at Eiffel then? > > :-) > > I don't get this joke, but it sounds like the basis for it > would be interesting. Can you explain? Bertrand Meyer, the inventor of Eiffel uses rich text to display code in his books. The commercial Eiffel IDE that his company ISE sells us

Re: [Tutor] Control flow

2005-01-28 Thread Orri Ganel
Gilbert Tsang wrote: Hi there, I have this logic that I cannot wrap my mind it: def go_jogging(): # go out and jog return if ( bad_weather =='y' ): # ask user only if weather is bad. b = input ( "Weather is really bad, still go out to jog?[y/n]" ) if b == 'y': go_jogging() e

Re: [Tutor] Control flow

2005-01-28 Thread Orri Ganel
Gilbert Tsang wrote: Hi there, I have this logic that I cannot wrap my mind it: def go_jogging(): # go out and jog return if ( bad_weather =='y' ): # ask user only if weather is bad. b = input ( "Weather is really bad, still go out to jog?[y/n]" ) if b == 'y': go_jogging() e

[Tutor] Control flow

2005-01-28 Thread Gilbert Tsang
Hi there, I have this logic that I cannot wrap my mind it: def go_jogging(): # go out and jog return if ( bad_weather =='y' ): # ask user only if weather is bad. b = input ( "Weather is really bad, still go out to jog?[y/n]" ) if b == 'y': go_jogging() else: # program

Re: [Tutor] Naming conventions

2005-01-28 Thread Kent Johnson
Terry Carroll wrote: On Wed, 26 Jan 2005, Sean Perry wrote: And now, for the pedant in me. I would recommend against naming functions with initial capital letters. In many languages, this implies a new type (like your Water class). so CombineWater should be combineWater. I hate hate hate hate hat

[Tutor] Naming conventions (was: Should this be a list comprehension or something?

2005-01-28 Thread Terry Carroll
On Wed, 26 Jan 2005, Sean Perry wrote: > And now, for the pedant in me. I would recommend against naming > functions with initial capital letters. In many languages, this implies > a new type (like your Water class). so CombineWater should be combineWater. I hate hate hate hate hate camelcase and

Re: [Tutor] Should this be a list comprehension or something?

2005-01-28 Thread Terry Carroll
Sorry for not responding earlier to thank all the people who weighed in on my question. I'm glad to find that my first take on it was sufficiently pythonic. Alan, I'd never seen the criterion befor that list comprehensions should be used to generate other lists. That's helpful, and I'll keep

Re: [Tutor] Should this be a list comprehension or something?

2005-01-28 Thread Terry Carroll
On Fri, 28 Jan 2005, Alan Gauld wrote: > > Oh wait, I know: let's all start writing code in MS Word .doc > format! > > Arial for functions, Times New Roman for classes. Who's with me? > ;-) > > So you've been looking at Eiffel then? > :-) I don't get this joke, but it sounds like the basis for i

[Tutor] How does import work?

2005-01-28 Thread Johan Nilsson
Hi all, I am rather new to python. I am trying to write a program using the scipy package. I have come across a problem that confuses me, and I hope that someone could give me an hint on how to solve this. Here is what I do Start idle >>> from scipy.signal.signaltools import * /Traceback (most r

Re: [Tutor] Advise...

2005-01-28 Thread Johan Nilsson
Jacob, Apart from all the other comments you received, here are my thoughts. I think you could do one more thing to speed up your calculations and that is to use a more efficient method. The Reimann sum is not a very efficient. One simple method that is rahter popular is Simpson's rule. The

Re: [Tutor] Preffered way to search posix filesystem

2005-01-28 Thread Kent Johnson
Miles Stevenson wrote: What is interesting is that the latest 2.4 Python docs say that walk() returns a Tuple, which is untrue. It returns a generator object according to type(). This had me heavily confused as to how to use what was returned from walk() and it took a good hour of troubleshooting

Re: [Tutor] Preffered way to search posix filesystem

2005-01-28 Thread Miles Stevenson
Thanks for the advice! My problem was that the built-in Python docs in Kdevelop weren't up-to-date, and I had trouble finding walk() in the docs. Here is the approach that I used being a python newbie (improvements are welcome): def getfiles(path): """Recursively search a path and genera

Re: [Tutor] Re: sorting a 2 gb file- i shrunk it and turned it around

2005-01-28 Thread Kent Johnson
Scott Melnyk wrote: Hello again! Thank you everyone for all the help. Congratulations on getting this working! I can see where any of the chains appear more than once, which is good and I am looking for situations like first example where ENST0339563.1 is the first and third on the list or the

[Tutor] Re: sorting a 2 gb file- i shrunk it and turned it around

2005-01-28 Thread Scott Melnyk
Hello again! Thank you everyone for all the help. The most important step in dealing with Blast results is getting rid of all the extraneous information. The standard result file gives you everything you could ask for when comparing DNA sequences, however at this step I am looking for specific d