Re: Testing for presence of arguments

2005-08-18 Thread Madhusudan Singh
Peter Maas wrote: >> Thanks for the suggestion, but seems needlessly complicated for > > something very simple. > > What is "very simple"? The problem or the solution? :) If you examine The form of the solution. > this suggestion more closely you will note that it is more or less > the same as

Re: Testing for presence of arguments

2005-08-18 Thread Peter Maas
Madhusudan Singh schrieb: > Dan Sommers wrote: [...] >>class _SemiPrivateClass: >>pass >> >>def f(required_argument=_SemiPrivateClass): >>if required_argument == _SemiPrivateClass: >>print "required_argument was probably not present" >>else: >>

Re: Testing for presence of arguments

2005-08-17 Thread Robert Kern
Madhusudan Singh wrote: > Unrelated question, how does one call a fortran 95 subroutine from python ? > I need really high speed of execution for that call (needed for each > measurement point, and is used to calculate some parameters for the > excitation for the next measurement point) and a scri

Re: Testing for presence of arguments

2005-08-17 Thread Madhusudan Singh
Diez B. Roggisch wrote: > I still don't see why default arguments like None won't do the trick. > If The argument _can_ > be some value (let's say an int) or None, you still could go for a > default value like () or any other value > from a different domain. "None" works perfectly. Someone else o

Re: Testing for presence of arguments

2005-08-17 Thread Diez B. Roggisch
> I am writing some code for a measurement application (would have used > fortran 95 if a library had been available for linux-gpib, but python is a > lot friendlier than C without the irritating and utterly pointless braces) > where one of the input parameters for the GPIB command is optional, and

Re: Testing for presence of arguments

2005-08-17 Thread Madhusudan Singh
Peter Decker wrote: > On 8/17/05, Madhusudan Singh <[EMAIL PROTECTED]> wrote: > >> I know how to set optional arguments in the function definition. Is there >> an intrinsic function that determines if a certain argument was actually >> passed ? Like the fortran 95 present() logical intrinsic ? >>

Re: Testing for presence of arguments

2005-08-17 Thread Madhusudan Singh
Dan Sommers wrote: > On Wed, 17 Aug 2005 11:13:03 -0400, > Madhusudan Singh <[EMAIL PROTECTED]> wrote: > >> I know how to set optional arguments in the function definition. Is >> there an intrinsic function that determines if a certain argument was >> actually passed ? Like the fortran 95 present

Re: Testing for presence of arguments

2005-08-17 Thread Madhusudan Singh
Benji York wrote: > Madhusudan Singh wrote: >> I know how to set optional arguments in the function definition. Is there >> an intrinsic function that determines if a certain argument was actually >> passed ? Like the fortran 95 present() logical intrinsic ? > > People generally use a value that

Re: Testing for presence of arguments

2005-08-17 Thread Madhusudan Singh
Diez B. Roggisch wrote: > I don't have the details ready - but in the ASPN cookbook are recipes > to e.g. figure insied a function f out how many results the caller of f > expects - and act accordingly. This boils down to inspect the > call-stack. So it ceratinly is possible. > > However, I'd say

Re: Testing for presence of arguments

2005-08-17 Thread Diez B. Roggisch
I don't have the details ready - but in the ASPN cookbook are recipes to e.g. figure insied a function f out how many results the caller of f expects - and act accordingly. This boils down to inspect the call-stack. So it ceratinly is possible. However, I'd say it is almost 100% a design flaw. Or

Re: Testing for presence of arguments

2005-08-17 Thread Benji York
Madhusudan Singh wrote: > I know how to set optional arguments in the function definition. Is there an > intrinsic function that determines if a certain argument was actually > passed ? Like the fortran 95 present() logical intrinsic ? People generally use a value that isn't a valid option, often

Re: Testing for presence of arguments

2005-08-17 Thread Dan Sommers
On Wed, 17 Aug 2005 11:13:03 -0400, Madhusudan Singh <[EMAIL PROTECTED]> wrote: > I know how to set optional arguments in the function definition. Is > there an intrinsic function that determines if a certain argument was > actually passed ? Like the fortran 95 present() logical intrinsic ? d

Re: Testing for presence of arguments

2005-08-17 Thread Peter Decker
On 8/17/05, Madhusudan Singh <[EMAIL PROTECTED]> wrote: > I know how to set optional arguments in the function definition. Is there an > intrinsic function that determines if a certain argument was actually > passed ? Like the fortran 95 present() logical intrinsic ? > > My required functionality