Re: [Tutor] Static Variable in Functions

2011-03-15 Thread Tom Zych
Steven D'Aprano wrote: Most of the common built-in Python objects are immutable: ... while a few are mutable: lists dicts sets Also, bytearrays. -- Tom Zych / freethin...@pobox.com ___ Tutor maillist - Tutor@python.org To unsubscribe or

Re: [Tutor] How to use a str object, to find the class in exact name?

2011-03-15 Thread Yaşar Arabacı
Thanks for excellent explanations. I almost got this working. I just have one more problem, that is: When user enter incorrect number of arguments for a method, I naturally get a type error. I could probably fix that with try and catch, but that is not very explanatory to the user. Is there a

Re: [Tutor] How to use a str object, to find the class in exact name?

2011-03-15 Thread Japhy Bartlett
I hate to jump on this one a little late, but even getattr() is kind of ghetto (though exec/eval is worse ;). For setting up shell scripts or CLIs, the usual route is the optparse module. - Japhy 2011/3/15 Yaşar Arabacı yasar11...@gmail.com: Thanks for excellent explanations. I almost got this

[Tutor] Processing Financial Calculations using Python

2011-03-15 Thread Carla Jenkins
Are there specific Python commands to process present value, future value and net present value?  Thanks.   Sincerely, Carla Jenkins ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options:

Re: [Tutor] Processing Financial Calculations using Python

2011-03-15 Thread Wayne Werner
On Tue, Mar 15, 2011 at 7:00 PM, Carla Jenkins carlarjenk...@yahoo.comwrote: Are there specific Python commands to process present value, future value and net present value? Thanks. http://tinyurl.com/4j5exao http://tinyurl.com/67x2to8 HTH, Wayne Sincerely, Carla Jenkins

[Tutor] atr in dir Vs. hasattr

2011-03-15 Thread Tim Johnson
What is the difference between using hasattr(object, name) and name in dir(object) ? TIA -- Tim tim at johnsons-web dot com or akwebsoft dot com http://www.akwebsoft.com ___ Tutor maillist - Tutor@python.org To unsubscribe or change

Re: [Tutor] atr in dir Vs. hasattr

2011-03-15 Thread Wayne Werner
On Tue, Mar 15, 2011 at 8:00 PM, Tim Johnson t...@johnsons-web.com wrote: What is the difference between using hasattr(object, name) and name in dir(object) hasattr is basically try: object.name return True except AttributeError: return False while name in dir(object) is

[Tutor] first steps

2011-03-15 Thread Ryan McAdam
I'm a newbie running my very first module . . . Specs: Mac OSX 10.6.6 Python 3.2 IDLE v 3.2 Tk v 8.5 I saved this module to my desktop # File: chaos.py # A simple program illustrating chaotic behavior. def main(): print(This program illustrates a chaotic function) x =

[Tutor] atr in dir Vs. hasattr

2011-03-15 Thread Tim Johnson
This following post was originally posted to the wrong thread. I am reposting (hopefully correctly) with the first and very succint response. I thing the answer is a revealation to be noted: ## On Tue, Mar 15, 2011 at 8:00 PM, Tim Johnson

[Tutor] first steps

2011-03-15 Thread Donald Bedsole
Hi Ryan, Also, when it works correctly, IDLE won't run the program again via the chaos.main() statement. I get this: Traceback (most recent call last): File pyshell#1, line 1, in module chaos.main() NameError: name 'chaos' is not defined I think IDLE is looking for a file name to run. If

[Tutor] first steps

2011-03-15 Thread Donald Bedsole
Ryan, Did you enter it like this at the prompt: chaos.main() statement If so, that's a problem. Your function was called: main(), so if you type chaos.main(), Python doesn't know what you're talking about. ___ Tutor maillist - Tutor@python.org To

Re: [Tutor] Boolean question

2011-03-15 Thread Jack Trades
On Wed, Mar 16, 2011 at 12:22 AM, Donald Bedsole drbeds...@gmail.comwrote: not (False and True) Python evaluates it as True Is it because: 1)You evaluate what's in the parentheses first. A thing can not be false and true at the same time, so the answer is false. Yes, the expression in