Re: [Tutor] role playing game - help needed

2010-12-11 Thread Steven D'Aprano
David Hutto wrote: On Sat, Dec 11, 2010 at 11:54 AM, Lie Ryan wrote: On 12/07/10 23:37, Robert Sjöblom wrote: I've been told to use input() if I know that I'll only get integers, and raw_input() for "everything." That is a bad piece of advice. You should only use input() when you can fully tr

Re: [Tutor] 'or' in assignment (not if statement)?

2010-12-11 Thread Steven D'Aprano
Lie Ryan wrote: The question "Would you like Italian or Chinese for dinner" is actually a contraction of "Would you like Italian for dinner or would you like Chinese for dinner". If we ask these two questions separately to the wife, we get either "Yes or Yes", "Yes or No", "No or Yes", or "No or

Re: [Tutor] Ressources for licensing

2010-12-11 Thread David Hutto
On Sat, Dec 11, 2010 at 9:52 AM, Knacktus wrote: > Hi everyone, > > can anybody recommend a lib or some other ressources about license > mechanisms of desktop applications written in python. I'm thinking of a > license-key that can be used to limit the time the application can be used. > I also ne

Re: [Tutor] role playing game - help needed

2010-12-11 Thread David Hutto
On Sat, Dec 11, 2010 at 11:54 AM, Lie Ryan wrote: > On 12/07/10 23:37, Robert Sjöblom wrote: >> I've been told to use input() if I know that I'll only get integers, >> and raw_input() for "everything." > > That is a bad piece of advice. You should only use input() when you can > fully trust whoeve

Re: [Tutor] Slicing Tuples

2010-12-11 Thread David Hutto
So, in essence, that would be redefining(in Python) basic division of grammatical structures(splices)? ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Code evaluation inside of string fails with __get_item

2010-12-11 Thread Steven D'Aprano
Tim Johnson wrote: I've never had the occasion to use assert() or any other python - shooting tools, any thoughts on that? Assertions are a great tool, but never ever, under pain of great pain, use assert for testing user input or function arguments. It's tempting to knock up a quick a

Re: [Tutor] 'or' in assignment (not if statement)?

2010-12-11 Thread Lie Ryan
On 12/11/10 04:12, Alan Gauld wrote: > "Steven D'Aprano" wrote >> As an experiment, offer to buy your wife dinner, and ask if she'd >> prefer to go to an Italian or Chinese restaurant. > > :-) > She would either answer "Yes" (she would like to go to one of > them, and if I'm lucky she might give

Re: [Tutor] Dictionaries - Using 1 Key:Value to find another

2010-12-11 Thread Al Stern
Ah. Turns out I was just sloppy and/or stupid. I realized I had another error once I fixed the '==' part. My new code which seems to work is... elif choice == "8": print ("Find the grandson of a person in the list.") grandfather = input("Which father do you want to look up to se

Re: [Tutor] Dictionaries - Using 1 Key:Value to find another

2010-12-11 Thread David
On 12 December 2010 11:10, Al Stern wrote: > > I thought father got defined in the > > father == pairs[grandfather] > line. I have tried it a couple different ways but always get the father is > not defined error once I enter the name. I only glanced at your code, but maybe you have some typos t

Re: [Tutor] Dictionaries - Using 1 Key:Value to find another

2010-12-11 Thread col speed
On 12 December 2010 07:10, Al Stern wrote: > This was another execise in my book. Following is my code for a program > that uses dictionaries to find and edit pairs of fathers and sons. The > program works right up to the final step which is to find out if any given > father is actually a grand

[Tutor] Dictionaries - Using 1 Key:Value to find another

2010-12-11 Thread Al Stern
This was another execise in my book. Following is my code for a program that uses dictionaries to find and edit pairs of fathers and sons. The program works right up to the final step which is to find out if any given father is actually a grandfather to someone else in the dictionary. I set up m

[Tutor] Beginning Python and other resources (was Re: Slicing Tuples)

2010-12-11 Thread David
On 12 December 2010 03:25, John Russell wrote: > Last night I started working through a book (Beginning Python: Using Python > 2.6 and Python 3.1) I bought to learn Python, and there is an example in it > that doesn't make sense to me. I have that book too, and several others thankfully. I'm jus

Re: [Tutor] Slicing Tuples

2010-12-11 Thread Steven D'Aprano
John Russell wrote: So, my question is this, and I realize that this is *very* basic - what is going on with the last element? Why is it returning one less than I think it logically should. Am I missing something here? There is not much of an explanation in the book, but I would really like to u

Re: [Tutor] using a networked data file

2010-12-11 Thread Bill Allen
David, Thanks for the feedback. I should have been more specific on the usage of the data. The data will be some email addresses, names, department, and an indicator if the email address is internal to the business or an external contact. So, one table with these being the fields in each rec

Re: [Tutor] Slicing Tuples

2010-12-11 Thread Hugo Arts
On Sat, Dec 11, 2010 at 5:25 PM, John Russell wrote: > Last night I started working through a book (Beginning Python: Using Python > 2.6 and Python 3.1)  I bought to learn Python, and there is an example in it > that doesn't make sense to me. > There is an example on slicing sequences that goes li

Re: [Tutor] role playing game - help needed

2010-12-11 Thread Lie Ryan
On 12/07/10 23:37, Robert Sjöblom wrote: > I've been told to use input() if I know that I'll only get integers, > and raw_input() for "everything." That is a bad piece of advice. You should only use input() when you can fully trust whoever doing the input (i.e. you). input() can accept any python

Re: [Tutor] Code evaluation inside of string fails with __get_item

2010-12-11 Thread Tim Johnson
* Peter Otten <__pete...@web.de> [101211 03:41]: > (1) the method is spelt __getitem__ (two leading and two trailing > underscores) > > (2) the left side is a python string with legal "%(...)s"-style format > expressions. Given a format string > > s = "%(s.upper())s" > > try to feed it a real

[Tutor] Slicing Tuples

2010-12-11 Thread John Russell
Last night I started working through a book (Beginning Python: Using Python 2.6 and Python 3.1) I bought to learn Python, and there is an example in it that doesn't make sense to me. There is an example on slicing sequences that goes like this: slice_me=("The", "next", "time", "we","meet","the",

[Tutor] Ressources for licensing

2010-12-11 Thread Knacktus
Hi everyone, can anybody recommend a lib or some other ressources about license mechanisms of desktop applications written in python. I'm thinking of a license-key that can be used to limit the time the application can be used. I also need to exploit the usage of a license server. Cheers, J

Re: [Tutor] using a networked data file

2010-12-11 Thread David Hutto
On Fri, Dec 10, 2010 at 10:23 PM, Bill Allen wrote: > This is somewhat non-Python specific   I have an idea for a Python > application that I want to write at work.  The application needs to have a > data file be available to multiple users for access, read and write.   I > know that a typical dat

Re: [Tutor] Code evaluation inside of string fails with __get_item

2010-12-11 Thread Peter Otten
Tim Johnson wrote: > This is a resend. I note that the original had an incorrect > `reply-to' ID attached to it. (sorry) > -- > I'm using Python 2.6.5. > The following problem is coming from inside of a complex code base > and involve