sorting question

2007-04-25 Thread belinda thom
Hi, I've had a look at http://wiki.python.org/moin/HowTo/Sorting, but am not sure if I can get the operator.itemgetter to do what I want for my particular need. I'm also not sure why creating my own cmp for pulling tuple parts out and passing it to a list sort doesn't just work. I'm sure

Re: exit to interpreter?

2007-04-03 Thread belinda thom
On Mar 24, 2007, at 4:30 AM, Dennis Lee Bieber wrote: On Fri, 23 Mar 2007 10:52:09 -0700, belinda thom [EMAIL PROTECTED] declaimed the following in comp.lang.python: Hi, I'm writing a function that polls the user for keyboard input, looping until it has determined that the user has

exit to interpreter?

2007-03-23 Thread belinda thom
Hi, I'm writing a function that polls the user for keyboard input, looping until it has determined that the user has entered a valid string of characters, in which case it returns that string so it can be processed up the call stack. My problem is this. I'd also like it to handle a

Re: exit to interpreter?

2007-03-23 Thread belinda thom
On Mar 23, 2007, at 11:04 AM, [EMAIL PROTECTED] wrote: On Mar 23, 12:52 pm, belinda thom [EMAIL PROTECTED] wrote: Hi, I'm writing a function that polls the user for keyboard input, looping until it has determined that the user has entered a valid string of characters, in which case

Re: exit to interpreter?

2007-03-23 Thread belinda thom
Thanks to all. I had suspected this was the best way to go, but as I'm fairly new to Python, it seemed worth a check. --b On Mar 23, 2007, at 12:48 PM, [EMAIL PROTECTED] wrote: On Mar 23, 1:20 pm, belinda thom [EMAIL PROTECTED] wrote: On Mar 23, 2007, at 11:04 AM, [EMAIL PROTECTED] wrote

class / instance question

2007-03-22 Thread belinda thom
Hello, I'm hoping the Python community knows whether or not the following is possible, and if it is possible, how I would go about writing code to do this. I've written two game classes---Nim and TicTacToe---where each derives from a Game class that I've created (it is essentially an

Re: class / instance question

2007-03-22 Thread belinda thom
On Mar 22, 2007, at 7:10 PM, Ben Finney wrote: abstract base class, where I've used an abstract() hack to somewhat enforce this). You can use the 'NotImplemented' built-in object, or the 'NotImplementedError' exception, for this purpose: Thanks---I'd forgotten about that. I now want to

Re: modules...n methods

2007-01-12 Thread belinda thom
On Jan 12, 2007, at 8:56 AM, Bjoern Schliessmann wrote: lee wrote: whats the way to read the sourcecode of methods Easy. Look up the .py file and open it in an editor of your choice. Those files are, for example, in /usr/lib/python. and built in functions? This becomes a lot easier if

Re: Pythonic A*-Algorithm

2007-01-11 Thread belinda thom
Willi, Maybe you could use something from the Python AIMA code? http:// aima.cs.berkeley.edu/code.html On Jan 11, 2007, at 1:01 PM, Willi Richert wrote: Hi, I'm looking for an A* implementation in Python (at least some wrapper around a C lib). So far I've only found

Re: private variables

2007-01-09 Thread belinda thom
On Jan 9, 2007, at 12:20 AM, Bruno Desthuilliers wrote: belinda thom a écrit : Hello, In what version of python were private variables added? Which private variables ? Haha. The ones that are provided for convenience (via name mangling) that aren't really private if you wish to violate

private variables

2007-01-08 Thread belinda thom
Hello, In what version of python were private variables added? Thanks, --b -- http://mail.python.org/mailman/listinfo/python-list

Re: private variables

2007-01-08 Thread belinda thom
no preference for one vs. the other. --b On Jan 8, 2007, at 10:11 PM, Thomas Ploch wrote: belinda thom schrieb: Hello, In what version of python were private variables added? Thanks, --b With this question you stepped into a bee hive. :-) Read the 'Why less emphasis on private data

checking one's type

2007-01-05 Thread belinda thom
Hi, I've been using the following hack to determine if a type is acceptable and I suspect there is a better way to do it: e.g. if type(s) == type() : print okay, i'm happy you're a string If anyone knows a better way, I'm all ears. Thanks, --b --

Re: checking one's type

2007-01-05 Thread belinda thom
thanks :-) On Jan 5, 2007, at 1:05 AM, Gabriel Genellina wrote: At Friday 5/1/2007 05:40, belinda thom wrote: I've been using the following hack to determine if a type is acceptable and I suspect there is a better way to do it: This has been discussed today under the thread Set type

Re: Set type?

2007-01-04 Thread belinda thom
I've seen people do that using an exception, e.g. try: foo except : #variable foo not defined On Jan 4, 2007, at 10:48 AM, _ wrote: How do you check to see if a variable is a set? I would like to use if type(var) is types.SetType: blah but that is not available in types module.

Re: What is proper way to require a method to be overridden?

2007-01-04 Thread belinda thom
On Jan 4, 2007, at 7:56 PM, Thomas Ploch wrote: Gabriel Genellina schrieb: At Thursday 4/1/2007 23:52, jeremito wrote: I am writing a class that is intended to be subclassed. What is the proper way to indicate that a sub class must override a method? If any subclass *must* override a

Re: What is proper way to require a method to be overridden?

2007-01-04 Thread belinda thom
On Jan 4, 2007, at 9:28 PM, Carl Banks wrote: jeremito wrote: I am writing a class that is intended to be subclassed. What is the proper way to indicate that a sub class must override a method? You can't (easily). If your subclass doesn't override a method, then you'll get a big fat

doctesting

2007-01-02 Thread belinda thom
Hi, I'd like to write a tester script that I can place in one place (say ~/bin/python/tester.py) and then have it visible to me at the cmd- line (by setting the path variable appropriately). I have had no luck in getting it to work, however. It appears like the doctest code itself assumes