Re: namespace issue, Python vs numpy min/max problem

2010-11-14 Thread Robert Kern
On 2010-11-14 17:37 , Gregory Ewing wrote: Steven D'Aprano wrote: It only becomes your problem if you have advised people that the right way to use your module is with import *. And if you're advising people to do that, it would be an extremely good idea to give your functions different names

Re: namespace issue, Python vs numpy min/max problem

2010-11-14 Thread Gregory Ewing
Steven D'Aprano wrote: It only becomes your problem if you have advised people that the right way to use your module is with import *. And if you're advising people to do that, it would be an extremely good idea to give your functions different names so that they don't conflict with the builti

Re: namespace issue, Python vs numpy min/max problem

2010-11-13 Thread Steven D'Aprano
On Sat, 13 Nov 2010 11:41:09 -0800, dmitrey wrote: > hi all, > I have the following problem: > I have overloaded "max" function in my module (FuncDesigner); it works > like following: > if some data in arguments is of type "oofun" then my function works, > elseware numpy.max() is used. > > Now th

Re: namespace issue, Python vs numpy min/max problem

2010-11-13 Thread Terry Reedy
On 11/13/2010 2:41 PM, dmitrey wrote: hi all, I have the following problem: I have overloaded "max" function in my module (FuncDesigner); it works like following: if some data in arguments is of type "oofun" then my function works, elseware numpy.max() is used. Now the problem: suppose someone w

Re: namespace issue, Python vs numpy min/max problem

2010-11-13 Thread Ben James
On 13/11/2010 19:55, dmitrey wrote: Well, I think I have found an appropriate solution. Regards, D. Hi Dmitrey, Would you mind briefly describing your solution? Thanks, Ben -- http://mail.python.org/mailman/listinfo/python-list

Re: namespace issue, Python vs numpy min/max problem

2010-11-13 Thread dmitrey
Well, I think I have found an appropriate solution. Regards, D. -- http://mail.python.org/mailman/listinfo/python-list

Re: Namespace issue

2007-05-23 Thread 7stud
On May 23, 12:20 pm, Ritesh Raj Sarraf <[EMAIL PROTECTED]> wrote: > As per my understanding, the bad part is that on every call of the method > FetchData(), an import would be done. > > To not let that happen, I can put the import into __init__(). But when I put > in there, I get a NameError saying

Re: Namespace issue

2007-05-23 Thread 7stud
On May 23, 12:20 pm, Ritesh Raj Sarraf <[EMAIL PROTECTED]> wrote: > As per my understanding, the bad part is that on every call of the method > FetchData(), an import would be done. > > To not let that happen, I can put the import into __init__(). But when I put > in there, I get a NameError saying

Re: Namespace issue

2007-05-23 Thread 7stud
On May 23, 12:20 pm, Ritesh Raj Sarraf <[EMAIL PROTECTED]> wrote: > As per my understanding, the bad part is that on every call of the method > FetchData(), an import would be done. > > To not let that happen, I can put the import into __init__(). But when I put > in there, I get a NameError saying

Re: Namespace issue

2007-05-23 Thread kyosohma
On May 23, 1:20 pm, Ritesh Raj Sarraf <[EMAIL PROTECTED]> wrote: > Hi, > > I need a little help in understanding how Namespaces and scoping works with > Classes/Functions in Python. > > Here's my code: > class FetchData: > def __init__(self, dataTypes=["foo", "bar", "spam"], archive=False): > >

Re: Namespace issue

2007-05-23 Thread kyosohma
On May 23, 1:20 pm, Ritesh Raj Sarraf <[EMAIL PROTECTED]> wrote: > Hi, > > I need a little help in understanding how Namespaces and scoping works with > Classes/Functions in Python. > > Here's my code: > class FetchData: > def __init__(self, dataTypes=["foo", "bar", "spam"], archive=False): > >

Re: namespace issue

2006-04-14 Thread Daniel Nogradi
> def _gn(x): > return x.upper() > > great_name = _gn > > class myclass: > def mymethod(self, great_name=False): > if great_name: > return _gn('something') > else: > return 'something' > >>> def great_name(x): > ... return x.upper() > ... > >>

Re: namespace issue

2006-04-13 Thread Steven D'Aprano
On Thu, 13 Apr 2006 22:59:52 +0200, Daniel Nogradi wrote: > I would like to give the same name to a keyword argument of a class > method as the name of a function, with the function and the class > living in the same namespace and the class method using the > aforementioned function. That's a pr

Re: namespace issue

2006-04-13 Thread Steven Bethard
Daniel Nogradi wrote: > I would like to give the same name to a keyword argument of a class > method as the name of a function, with the function and the class > living in the same namespace and the class method using the > aforementioned function. So far I've been unsuccesfully trying to go > alon

Re: namespace issue

2006-04-13 Thread Daniel Nogradi
Ooops, there was a typo in my previous mail: > in the hope of the del statement only removing the local variable util ^ the above line should be: in the hope of the del statement only removing the lo