On Wed, Aug 12, 2020 at 12:03 PM Lele Gaifax wrote:
> But I see this is somewhat fragile, and wonder about a proper fix, but isn't
> that a reasonable usage of the "locals" argument to exec()?
>
I'm not sure. Passing a locals argument to eval() I have sometimes
done, but never exec(). I've always
Chris Angelico writes:
> Interesting. You're passing an empty globals and a non-empty locals
> (the second and third arguments to exec, respectively). Is that
> deliberate? By the look of this code, it's meant to be at global scope
> (as if it's the top level code in a module), which is best done
On Tue, Aug 11, 2020 at 5:44 AM Lele Gaifax wrote:
>
> Hi all,
>
> today I faced an issue that, although very easy to fix, left me wondering
> about what causes it.
>
> The context is an application that execute small scripts coming from an
> external source (say, a database). The application firs
Hi all,
today I faced an issue that, although very easy to fix, left me wondering
about what causes it.
The context is an application that execute small scripts coming from an
external source (say, a database). The application first compile the script,
then execute it passing it some values: in t
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
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
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
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
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
Well, I think I have found an appropriate solution.
Regards, D.
--
http://mail.python.org/mailman/listinfo/python-list
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 writes
from FuncDesigner import *
...
a =
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
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
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
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):
>
>
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):
>
>
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):
self.List = []
self.Types = dataTypes
if
> 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()
> ...
> >>
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
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
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
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
along these lines:
def great_name(
22 matches
Mail list logo