Re: [Tutor] Boolean question

2011-03-15 Thread Jack Trades
On Wed, Mar 16, 2011 at 1:24 AM, Donald Bedsole wrote: > > Ok, so, as another example: > > not(True and False) is "True" > > because: the first argument "True" is true, and the second argument > "False" when returned is negated by "not" becomes "not False" which > evaluates to True? > > Correct.

Re: [Tutor] Boolean question

2011-03-15 Thread Donald Bedsole
Hi Jack, On Wed, Mar 16, 2011 at 1:50 AM, Jack Trades wrote: > On Wed, Mar 16, 2011 at 12:22 AM, Donald Bedsole > wrote: > >> not (False and True) >> >> Python evaluates it as "True" > > >> >> 1)You evaluate what's in the parentheses first.  A thing can not be >> false and true at the same time,

Re: [Tutor] Boolean question

2011-03-15 Thread Jack Trades
On Wed, Mar 16, 2011 at 12:22 AM, Donald Bedsole wrote: > > 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 the paren

[Tutor] Boolean question

2011-03-15 Thread Donald Bedsole
Hi folks, I'm working on Boolean Operators right now, and I'm getting it for the most part. But, could someone make sure I'm understanding this one expression correctly? not (False and True) Python evaluates it as "True" Is it because: 1)You evaluate what's in the parentheses first. A thing ca

[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.or

[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 "", line 1, in chaos.main() NameError: name 'chaos' is not defined I think IDLE is looking for a file name to run. If your file

[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 wr

Re: [Tutor] atr in dir Vs. hasattr

2011-03-15 Thread Tim Johnson
* Wayne Werner [110315 17:29]: > On Tue, Mar 15, 2011 at 8:00 PM, Tim Johnson 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: >

[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 = eval(

Re: [Tutor] atr in dir Vs. hasattr

2011-03-15 Thread Wayne Werner
On Tue, Mar 15, 2011 at 8:00 PM, Tim Johnson 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 (AFAIK) more lik

[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 subscription

Re: [Tutor] Processing Financial Calculations using Python

2011-03-15 Thread Wayne Werner
On Tue, Mar 15, 2011 at 7:00 PM, Carla Jenkins wrote: > 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] 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: http://mail.python.org/mai

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ı : > Thanks for excellent explanations. I almost got this working. I just hav

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] 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