Re: [Tutor] Check Number of Parameters Passed In

2008-07-13 Thread Kent Johnson
On Sun, Jul 13, 2008 at 9:05 PM, bob gailer <[EMAIL PROTECTED]> wrote: > As an alternative to Kent's suggestion consider: > > def foo(parameter, *args) > > args will be a tuple with 0, 1 or more items in it. > > So you can test for len(args) == 1 Presumably the OP wants to distinguish between op1

Re: [Tutor] Check Number of Parameters Passed In

2008-07-13 Thread bob gailer
James wrote: Hi All, I'm writing a function that has optional paramters (i.e., "foo( parameter , optionalParameter = None , optionalParameter2 = None )"). Is there some way inside of foo() that I can check to see how many parameters have been passed in? I want to check to ensure that only *one*

Re: [Tutor] Another assert() question

2008-07-13 Thread Dick Moores
At 03:57 PM 7/13/2008, bob gailer wrote: When all else fails RTFM: 5.10 Boolean operations "In the context of Boolean operations, and also when expressions are used by control flow statements, the following values are interpreted as false: |False|, |None|, numeric zero of all types, and

Re: [Tutor] Check Number of Parameters Passed In

2008-07-13 Thread Kent Johnson
On Sun, Jul 13, 2008 at 7:27 PM, James <[EMAIL PROTECTED]> wrote: > Hi All, > > I'm writing a function that has optional paramters (i.e., "foo( > parameter , optionalParameter = None , optionalParameter2 = None )"). > > Is there some way inside of foo() that I can check to see how many > parameters

[Tutor] Overriding Methods

2008-07-13 Thread Zach Riggle
I am implementing an application using XML-RPC, and would like to be able to differentiate between multiple clients. The best way to do this that I could think of would be to simply pass some unique identifier along with each call over XML-RPC. However, this could get to be a bit cumberso

[Tutor] Check Number of Parameters Passed In

2008-07-13 Thread James
Hi All, I'm writing a function that has optional paramters (i.e., "foo( parameter , optionalParameter = None , optionalParameter2 = None )"). Is there some way inside of foo() that I can check to see how many parameters have been passed in? I want to check to ensure that only *one* optional param

Re: [Tutor] Another assert() question

2008-07-13 Thread bob gailer
When all else fails RTFM: 5.10 Boolean operations "In the context of Boolean operations, and also when expressions are used by control flow statements, the following values are interpreted as false: |False|, |None|, numeric zero of all types, and empty strings and containers (including st

[Tutor] Fwd: Another assert() question

2008-07-13 Thread Marc Tompkins
Forgot to send to the list... On Sun, Jul 13, 2008 at 1:06 PM, Dick Moores <[EMAIL PROTECTED]> wrote: > Or is there an ambiguity in "evaluate" in Python that is well-understood > and doesn't cause a problem? > I should simply have said: "evaluate" is not a word IN Python (although "eval()" is,

Re: [Tutor] Another assert() question

2008-07-13 Thread Marc Tompkins
On Sun, Jul 13, 2008 at 1:06 PM, Dick Moores <[EMAIL PROTECTED]> wrote: > In other words, "(3,2)" isn't exactly the same as "True" - but it doesn't > evaluate to False, either, so it's true. > > > So what does (3,2) evaluate to? Or is that a meaningless question? However > in the following exampl

Re: [Tutor] Another assert() question

2008-07-13 Thread Dick Moores
At 08:46 PM 7/12/2008, Marc Tompkins wrote: On Sat, Jul 12, 2008 at 8:10 PM, Dick Moores <[EMAIL PROTECTED]> wrote: But why will a tuple with two elements will always evaluate to True? In [2]: (3,5) == True Out[2]: False In [3]: ("qwerty", "asdfg") == True Out[3]: False In [4]: The valu

Re: [Tutor] Another assert() question

2008-07-13 Thread Dick Moores
At 12:40 PM 7/13/2008, Martin Walsh wrote: Dick Moores wrote: > At 11:44 AM 7/13/2008, Steve Willoughby wrote: >> Dick Moores wrote: >>> Yes! A rule, not logic. I'm not contradicting Kent, just helping >>> myself understand. First the rule, then logic in the application of >>> the rule. And I ass

Re: [Tutor] Another assert() question

2008-07-13 Thread Marcel Wunderlich
Hi Dick, because set(list) creates an unsorted collection without duplicate entrys of the items in the list. If you pass an empty list, the resulting set will also be an empty collection. A list containing an empty list evaluates non false, since it's not empty. Maybe it helps you to compar

Re: [Tutor] Another assert() question

2008-07-13 Thread Martin Walsh
Dick Moores wrote: > At 11:44 AM 7/13/2008, Steve Willoughby wrote: >> Dick Moores wrote: >>> Yes! A rule, not logic. I'm not contradicting Kent, just helping >>> myself understand. First the rule, then logic in the application of >>> the rule. And I assume the rule is there in Python because it ma

Re: [Tutor] Another assert() question

2008-07-13 Thread Dick Moores
At 11:44 AM 7/13/2008, Steve Willoughby wrote: Dick Moores wrote: Yes! A rule, not logic. I'm not contradicting Kent, just helping myself understand. First the rule, then logic in the application of the rule. And I assume the rule is there in Python because it makes things work better. Yes, so a

Re: [Tutor] Another assert() question

2008-07-13 Thread Steve Willoughby
Dick Moores wrote: Yes! A rule, not logic. I'm not contradicting Kent, just helping myself understand. First the rule, then logic in the application of the rule. And I assume the rule is there in Python because it makes things work better. Yes, so a statement like "if foo:" becomes an idiom f

Re: [Tutor] Another assert() question

2008-07-13 Thread Dick Moores
At 12:50 AM 7/13/2008, Alan Gauld wrote: "Dick Moores" <[EMAIL PROTECTED]> wrote But why will a tuple with two elements will always evaluate to True? Thats the rule for evaluationg collections in Python. An empty collection is False. Anything else is therefore true Yes! A rule, not logic. I'm no

Re: [Tutor] Program launcher in taskbar

2008-07-13 Thread Alan Gauld
"ammar azif" <[EMAIL PROTECTED]> wrote I am running ubuntu as my development platform but the application is targeted for windows machine. Is there any platform dependent library that can help me Assuming you mean platform *independent* library I suspect the answer is no. Things like the ta

[Tutor] sys.platform in win XP 64 and vista 64?

2008-07-13 Thread claxo
Im correct in that sys.platform will return 'win32' even in 64bits XP-Vista (except for Cygwin builds)? In the python docs for 2.4 - 2.5 I havent found conclusive data; the docs for 2.6 seems to imply that. ___ Tutor maillist - Tutor@python.org htt

Re: [Tutor] Program launcher in taskbar

2008-07-13 Thread ammar azif
Hi, I am running ubuntu as my development platform but the application is targeted for windows machine. Is there any platform dependent library that can help me do this? --- On Sun, 7/13/08, Michiel Overtoom <[EMAIL PROTECTED]> wrote: From: Michiel Overtoom <[EMAIL PROTECTED]> Subject: Re: [Tut

[Tutor] pyopenssl - extracting email certificates information

2008-07-13 Thread Paul Tader
Given a raw email I've been able to extract the cryptographic signature (in encoded or decoded format) into a string. I would like to like to use the pyopenssl crypto module (http://pyopenssl.sourceforge.net/pyOpenSSL.html/openssl.html) to further extract things like the Signing Authority and the

Re: [Tutor] Program launcher in taskbar

2008-07-13 Thread Michiel Overtoom
Ammar wrote... > Is is possible to place my program icon in the system tray portion > of the taskbar (like instant messaging applications)? > The program will be launched by clicking on the icon. How to > do this in python and which module should I use? Are you on a Windows machine? Then you

[Tutor] Program launcher in taskbar

2008-07-13 Thread ammar azif
Hi, Is is possible to place my program icon in the system tray portion of the taskbar(like instant messaging applications)? The program will be launched by clicking on the icon. How to do this in python and which module should I use? ___ Tutor

Re: [Tutor] Another assert() question

2008-07-13 Thread Alan Gauld
"Dick Moores" <[EMAIL PROTECTED]> wrote But why will a tuple with two elements will always evaluate to True? Thats the rule for evaluationg collections in Python. An empty collection is False. Anything else is therefore true if []: -> false if [1,2]: -> true if (): -> false if (1,2) - True