From my understanding, `ast.arguments` and `inspect.Signature` are the
two builtin ways of defining the function name and arguments in a
structured way.
What I am creating is a way of configuring… well let's be specific to
my use-case. I am building a way to configure TensorFlow.
One whi
On Sun, 30 Dec 2018 at 05:58, Malcolm Greene wrote:
>
> I have a class method that adds additional context to many of the
> class's log messages. Rather than calling, for example, logger.info(
> 'message ...' ) I would like to call my_object.log( 'message ...' ) so
> that this additional context
Malcolm Greene wrote:
> I have a class method that adds additional context to many of the
> class's log messages. Rather than calling, for example, logger.info(
> 'message ...' ) I would like to call my_object.log( 'message ...' ) so
> that this additional context is managed in a single place. I'
I have a class method that adds additional context to many of the
class's log messages. Rather than calling, for example, logger.info(
'message ...' ) I would like to call my_object.log( 'message ...' ) so
that this additional context is managed in a single place. I'm actually
doing that and its w
Steven D'Aprano wrote:
> Be aware though, that sys._getframe is marked as a private function (the
> leading underscore), which means that:
>
> (1) It only exists in some Python implementations (CPython and possible
> nothing else?); and
$ jython
Jython 2.2.1 on java1.6.0_0
Type "copyright", "cre
On Wed, 28 Apr 2010 21:03:36 +0200, Peter Otten wrote:
> Richard Lamboj wrote:
>
>> is there any way to get the name from the actual called function, so
>> that the function knows its own name?
>
import sys
def my_name():
> ... return sys._getframe(1).f_code.co_name
Be aware thou
On 4/28/2010 3:20 PM, Alf P. Steinbach wrote:
* Richard Lamboj:
is there any way to get the name from the actual called function, so
that the
function knows its own name?
There was an earlier thread about this not very long ago.
General consensus, as I recall, to replace function with an obj
On 04/28/2010 01:50 PM, Emile van Sebille wrote:
On 4/28/2010 11:44 AM Richard Lamboj said...
is there any way to get the name from the actual called function, so that the
function knows its own name?
>>> def test():pass
...
>>> dir(test)
['__call__', '__class__', '__closure__', '__code_
* Richard Lamboj:
is there any way to get the name from the actual called function, so that the
function knows its own name?
There was an earlier thread about this not very long ago.
General consensus, as I recall, to replace function with an object of a class
(possibly with __call__ method
On Apr 28, 11:44 am, Richard Lamboj wrote:
> Hello,
>
> is there any way to get the name from the actual called function, so that the
> function knows its own name?
>
> Kind Regards,
>
> Richi
If you want to get the function name from within the function itself,
chec
On 2010-04-28, at 11:50 AM, Emile van Sebille wrote:
> On 4/28/2010 11:44 AM Richard Lamboj said...
>>
>> Hello,
>>
>> is there any way to get the name from the actual called function, so that the
>> function knows its own name?
>>
>> Kind Regards,
>>
>> Richi
> ActivePython 2.6.1.1 (ActiveSt
Richard Lamboj wrote:
> is there any way to get the name from the actual called function, so that
> the function knows its own name?
>>> import sys
>>> def my_name():
... return sys._getframe(1).f_code.co_name
...
>>> def rumpelstilzchen():
... print u"Ach, wie gut dass niemand weiß, dass
On 4/28/2010 11:44 AM Richard Lamboj said...
Hello,
is there any way to get the name from the actual called function, so that the
function knows its own name?
Kind Regards,
Richi
ActivePython 2.6.1.1 (ActiveState Software Inc.) based on
Python 2.6.1 (r261:67515, Dec 5 2008, 13:58:38) [MSC v
Hello,
is there any way to get the name from the actual called function, so that the
function knows its own name?
Kind Regards,
Richi
--
http://mail.python.org/mailman/listinfo/python-list
En Sat, 30 Jan 2010 06:28:19 -0300, Peter Otten <__pete...@web.de>
escribió:
Gabriel Genellina wrote:
En Fri, 29 Jan 2010 13:09:40 -0300, Michele Simionato
escribió:
On Jan 29, 2:30 pm, andrew cooke wrote:
Is there any way to change the name of the function in an error
message? In the ex
On Sat, 30 Jan 2010 14:26:43 -0800, andrew cooke wrote:
> On Jan 29, 11:50 am, exar...@twistedmatrix.com wrote:
>> new.function and new.code will let you construct new objects with
>> different values (and copying over whichever existing attributes you
>> want to preserve).
>
> unfortunately new
On Jan 29, 1:09 pm, Michele Simionato
wrote:
> On Jan 29, 2:30 pm, andrew cooke wrote:
>
> > Is there any way to change the name of the function in an error
> > message? In the example below I'd like the error to refer to bar(),
> > for example (the motivation is related function decorators - I'
On Jan 30, 7:17 pm, andrew cooke wrote:
> On Jan 29, 5:37 pm, "Gabriel Genellina"
> wrote:
>
> > The decorator module is a very fine addition to anyone's tool set -- but
> > in this case it is enough to use the wraps() function from the functools
> > standard module.
>
> ah, thanks! i though
On Jan 29, 11:50 am, exar...@twistedmatrix.com wrote:
> new.function and new.code will let you construct new objects with
> different values (and copying over whichever existing attributes you
> want to preserve).
unfortunately new is deprecated and dropped from 3. i can't see how
the same functi
On Jan 29, 5:37 pm, "Gabriel Genellina"
wrote:
> The decorator module is a very fine addition to anyone's tool set -- but
> in this case it is enough to use the wraps() function from the functools
> standard module.
ah, thanks! i thought something like this existed in the standard
lib, but c
On Jan 29, 11:22 am, Peter Otten <__pete...@web.de> wrote:
> The name is looked up in the code object. As that is immutable you have to
> make a new one:
[details snipped]
thanks very much! sorry i didn't reply earlier - been travelling.
(also, thanks to any other replies - i'm just reading thro
Gabriel Genellina wrote:
> En Fri, 29 Jan 2010 13:09:40 -0300, Michele Simionato
> escribió:
>
>> On Jan 29, 2:30 pm, andrew cooke wrote:
>>> Is there any way to change the name of the function in an error
>>> message? In the example below I'd like the error to refer to bar(),
>>> for example
En Fri, 29 Jan 2010 13:09:40 -0300, Michele Simionato
escribió:
On Jan 29, 2:30 pm, andrew cooke wrote:
Is there any way to change the name of the function in an error
message? In the example below I'd like the error to refer to bar(),
for example (the motivation is related function decora
On Jan 29, 2:30 pm, andrew cooke wrote:
> Is there any way to change the name of the function in an error
> message? In the example below I'd like the error to refer to bar(),
> for example (the motivation is related function decorators - I'd like
> the wrapper function to give the same name)
Us
On 02:10 pm, c...@rebertia.com wrote:
On Fri, Jan 29, 2010 at 5:30 AM, andrew cooke
wrote:
Is there any way to change the name of the function in an error
message? �In the example below I'd like the error to refer to bar(),
for example (the motivation is related function decorators - I'd like
t
andrew cooke wrote:
> Is there any way to change the name of the function in an error
> message? In the example below I'd like the error to refer to bar(),
> for example (the motivation is related function decorators - I'd like
> the wrapper function to give the same name)
>
def foo():
> ..
On Fri, Jan 29, 2010 at 5:30 AM, andrew cooke wrote:
> Is there any way to change the name of the function in an error
> message? In the example below I'd like the error to refer to bar(),
> for example (the motivation is related function decorators - I'd like
> the wrapper function to give the s
andrew cooke wrote:
Is there any way to change the name of the function in an error
message? In the example below I'd like the error to refer to bar(),
for example (the motivation is related function decorators - I'd like
the wrapper function to give the same name)
def foo():
...
Is there any way to change the name of the function in an error
message? In the example below I'd like the error to refer to bar(),
for example (the motivation is related function decorators - I'd like
the wrapper function to give the same name)
>>> def foo():
... return 7
...
>>> foo.__name
Christian Heimes wrote:
Philip Guo wrote:
Does anyone know how to get this information either from a code object or
from a related object? I am hacking the interpreter, so I have full access
to everything.
Does this help?
class A(object):
... def method(self):
... pass
...
A.m
Philip Guo wrote:
Hi all,
This is my first post, so sorry for the n00bish question. Let's say I
have 2 classes with the same __init__ method defined in a file foo.py:
class A:
def __init__(self):
pass
class B:
def __init__(self):
pass
For the purpose of a code analysis, I need
Philip Guo wrote:
> Does anyone know how to get this information either from a code object or
> from a related object? I am hacking the interpreter, so I have full access
> to everything.
Does this help?
>>> class A(object):
... def method(self):
... pass
...
>>> A.method.im_class
>
Hi all,
This is my first post, so sorry for the n00bish question. Let's say I have
2 classes with the same __init__ method defined in a file foo.py:
class A:
def __init__(self):
pass
class B:
def __init__(self):
pass
For the purpose of a code analysis, I need to get a UNIQUE name f
En Mon, 28 Sep 2009 22:54:55 -0300, Peng Yu escribió:
On Sun, Sep 20, 2009 at 12:43 PM, Benjamin Kaplan
wrote:
On Sun, Sep 20, 2009 at 12:43 PM, Peng Yu wrote:
On Sun, Sep 20, 2009 at 11:32 AM, Vijayendra Bapte
wrote:
class A:
@echo
def __repr__(self):
pass
What does @ech
On Sun, Sep 20, 2009 at 12:43 PM, Benjamin Kaplan
wrote:
> On Sun, Sep 20, 2009 at 12:43 PM, Peng Yu wrote:
>> On Sun, Sep 20, 2009 at 11:32 AM, Vijayendra Bapte
>> wrote:
>>> On Sep 20, 8:38 pm, Peng Yu wrote:
Hi,
I have the following code. I want to change the function body of
Peng Yu wrote:
> What does @echo mean?
Have you read _any_ of the documentation? Or is this all an exercise
in seeing if you can convince a group of disparate strangers to teach
you Python for free?
--
http://mail.python.org/mailman/listinfo/python-list
On Sun, Sep 20, 2009 at 12:43 PM, Peng Yu wrote:
> On Sun, Sep 20, 2009 at 11:32 AM, Vijayendra Bapte
> wrote:
>> On Sep 20, 8:38 pm, Peng Yu wrote:
>>> Hi,
>>>
>>> I have the following code. I want to change the function body of
>>> __repr__ to something like
>>>
>>> return 'In %s::%s' % ($
On Sep 20, 10:38 am, Peng Yu wrote:
> Hi,
>
> I have the following code. I want to change the function body of
> __repr__ to something like
PS: Methods get angry when you refer to them as functions . You see,
methods feel that they are more than a mere lowly function, and have
developed a superi
On Sun, Sep 20, 2009 at 11:32 AM, Vijayendra Bapte
wrote:
> On Sep 20, 8:38 pm, Peng Yu wrote:
>> Hi,
>>
>> I have the following code. I want to change the function body of
>> __repr__ to something like
>>
>> return 'In %s::%s' % ($class_name, $function_name)
>>
>> I'm wondering what I should
On Sep 20, 8:38 pm, Peng Yu wrote:
> Hi,
>
> I have the following code. I want to change the function body of
> __repr__ to something like
>
> return 'In %s::%s' % ($class_name, $function_name)
>
> I'm wondering what I should write for $class_name and $function_name in
> python.
>
> Regards,
Peng Yu wrote:
> Hi,
>
> I have the following code. I want to change the function body of
> __repr__ to something like
>
> return 'In %s::%s' % ($class_name, $function_name)
>
> I'm wondering what I should write for $class_name and $function_name
> in python.
>
> Regards,
> Peng
>
> cla
On Sep 20, 10:38 am, Peng Yu wrote:
> Hi,
>
> I have the following code. I want to change the function body of
> __repr__ to something like
>
> return 'In %s::%s' % ($class_name, $function_name)
>
> I'm wondering what I should write for $class_name and $function_name in
> python.
>
> Regards,
Hi,
I have the following code. I want to change the function body of
__repr__ to something like
return 'In %s::%s' % ($class_name, $function_name)
I'm wondering what I should write for $class_name and $function_name in python.
Regards,
Peng
class A:
def __init__(self):
pass
def __
rocky wrote:
Someone recently reported a problem in pydb where a function defined
in his program was conflicting with a module name that pydb uses. I
think I understand what's wrong, but I don't have any elegant
solutions to the problem. Suggestions would be appreciated.
In a nutshell, here's th
On Jul 7, 2:33 am, Peter Otten <__pete...@web.de> wrote:
> rocky wrote:
> > Someone recently reported a problem in pydb where a function defined
> > in his program was conflicting with amodulenamethat pydb uses. I
> > think I understand what's wrong, but I don't have any elegant
> > solutions to th
rocky wrote:
> Someone recently reported a problem in pydb where a function defined
> in his program was conflicting with a module name that pydb uses. I
> think I understand what's wrong, but I don't have any elegant
> solutions to the problem. Suggestions would be appreciated.
>
> In a nutshell
Someone recently reported a problem in pydb where a function defined
in his program was conflicting with a module name that pydb uses. I
think I understand what's wrong, but I don't have any elegant
solutions to the problem. Suggestions would be appreciated.
In a nutshell, here's the problem:
In
On Mar 30, 4:36 pm, Michele Simionato
wrote:
> On Mar 30, 3:31 pm, srepmub wrote:
>
> > for the record, the input forShedskinis pure Python, so there is no
> > added syntax or optional type declaration system. that said, I can
> > understand it not being on some list for not being production-read
Steven D'Aprano wrote:
On Mon, 30 Mar 2009 09:46:40 +0200, Hendrik van Rooyen wrote:
Its kind of sad to see unladen swallow, which is just a promise, on the
list, while Shedskin, which isn't, is ignored.
Does this say something about big corporations vs the small man?
No, what it says is tha
On Mon, 30 Mar 2009 09:46:40 +0200, Hendrik van Rooyen wrote:
> Its kind of sad to see unladen swallow, which is just a promise, on the
> list, while Shedskin, which isn't, is ignored.
>
> Does this say something about big corporations vs the small man?
No, what it says is that I had just read a
On Mar 30, 3:31 pm, srepmub wrote:
> for the record, the input for Shedskin is pure Python, so there is no
> added syntax or optional type declaration system. that said, I can
> understand it not being on some list for not being production-ready.
>
> thanks,
> mark dufour.
But does ShedSkin accep
> > Its kind of sad to see unladen swallow, which is just
> > a promise, on the list, whileShedskin, which isn't,
> > is ignored.
>
> > Does this say something about big corporations
> > vs the small man?
>
> I think the programs on the list were supposed to actually implement
> Python and extensi
"Hendrik van Rooyen" writes:
> Its kind of sad to see unladen swallow, which is just
> a promise, on the list, while Shedskin, which isn't,
> is ignored.
>
> Does this say something about big corporations
> vs the small man?
I think the programs on the list were supposed to actually implement
P
"Steven D'Aprano" wrote:
>Oh noes!!! Python will be just like nearly every other language!!!
>
>Including Python. There are already at least thirteen implementations
>(forks) of Python (although some of these are defunct or unmaintained):
>
>CPython
>Jython
>IronPython
>Python for .NET
>CLPytho
On Mar 29, 12:23 am, Steven D'Aprano wrote:
> On Fri, 27 Mar 2009 19:57:41 -0700, Aaron Brady wrote:
> > I see how c-l-py doesn't represent the full interests of Python,
>
> Python is a *programming language*. It doesn't have interests. It just
> sits there, a bunch of bits on a disk, waiting to b
On Fri, 27 Mar 2009 19:57:41 -0700, Aaron Brady wrote:
> I see how c-l-py doesn't represent the full interests of Python,
Python is a *programming language*. It doesn't have interests. It just
sits there, a bunch of bits on a disk, waiting to be used. *People* have
interests, and Python is a me
In article ,
andrew cooke wrote:
>
>c.l.python used to be the core of a community built around a language. It
>no longer is. It is a very useful place, where some very helpful and
>knowledgeable people hang out and give advice, but instead of representing
>the full interests of the Python commun
Andrew> c.l.python used to be the core of a community built around a
Andrew> language. It no longer is. It is a very useful place, where
Andrew> some very helpful and knowledgeable people hang out and give
Andrew> advice, but instead of representing the full interests of the
On Mar 27, 8:15 pm, "andrew cooke" wrote:
> Erik Max Francis wrote:
>
> [...]
>
> > And made all purdy-like:
>
> > http://www.alcyone.com/tmp/python-list%20traffic.pdf
>
> That's very pretty, but neither the volume of posts, nor the quality of
> the people posting here is really what I was talk
On Fri, 2009-03-27 at 21:15 -0400, andrew cooke wrote:
[...]
> c.l.python used to be the core of a community built around a language. It
> no longer is. It is a very useful place, where some very helpful and
> knowledgeable people hang out and give advice, but instead of representing
> the full
Erik Max Francis wrote:
[...]
> And made all purdy-like:
>
> http://www.alcyone.com/tmp/python-list%20traffic.pdf
That's very pretty, but neither the volume of posts, nor the quality of
the people posting here is really what I was talking about. I don't think
I explained very well, but seei
Albert Hopkins wrote:
I agree. If the argument is simply that some devs no longer hang here
but do on -dev than that's not declining to me, especially as the amount
of traffic on -dev increases. That's ordinary. Same for people coming
and going.
For me declining means the rate of (non-spam) po
In article ,
Nick Craig-Wood wrote:
>
>c.l.py is my favourite usenet group and has been for some time. I've
>been doing usenet for 16 years now!
Newbie. ;-)
--
Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/
"At Resolver we've found it useful to short-circuit an
Aahz wrote:
> Well, yes, but that's simply the nature of online fora (I originally
> wrote "nature of Usenet", but I think it's more general than that). From
> my POV, if you're going to call it a "decline", you need to provide more
> evidence than some people leaving and others arriving. I
Albert> For me declining means the rate of (non-spam) posts is steadily
Albert> dropping over time.
I know this wasn't the main point of your post, but if you subscribe to
python-list@python.org or read it via a mail-to-news gateway like Gmane I
think you will find the ratio of spam to ha
On Fri, 2009-03-27 at 10:47 -0700, Aahz wrote:
> In article ,
> andrew cooke wrote:
> >Aahz wrote:
> >>
> >> Excuse me? What decline of this newsgroup?
> >
> >Hmmm. It's hard to respond to this without implicitly criticising others
> >here, which wasn't my point at all. But my personal impress
Aahz> Excuse me? What decline of this newsgroup?
Andrew> But my personal impression is that over the years various
Andrew> people who used to post here now stay pretty firmly in the dev
Andrew> group, while others seem to have disappeared more or less
Andrew> completely
Aahz wrote:
In article ,
andrew cooke wrote:
you are trying to do very "deep" things that most people do not do with
python. that does not mean that there are no solutions, just that you
have to find them yourself (especially with the decline of this
newsgroup).
Excuse me? What decline of t
In article ,
andrew cooke wrote:
>Aahz wrote:
>>
>> Excuse me? What decline of this newsgroup?
>
>Hmmm. It's hard to respond to this without implicitly criticising others
>here, which wasn't my point at all. But my personal impression is that
>over the years various people who used to post here
Aahz wrote:
> Excuse me? What decline of this newsgroup?
Hmmm. It's hard to respond to this without implicitly criticising others
here, which wasn't my point at all. But my personal impression is that
over the years various people who used to post here now stay pretty firmly
in the dev group, w
In article ,
andrew cooke wrote:
>
>you are trying to do very "deep" things that most people do not do with
>python. that does not mean that there are no solutions, just that you
>have to find them yourself (especially with the decline of this
>newsgroup).
Excuse me? What decline of this newsgr
On Wed, 2009-03-18 at 08:18 -0700, Adam wrote:
> On Mar 18, 10:33 am, "J. Cliff Dyer" wrote:
> > You might be interested in redefining __getattribute__(self, attr) on
> > your class. This could operate in conjunction with the hash tables
> > (dictionaries) mentioned by andrew cooke. i.e. (untest
On Mar 18, 8:47 am, Adam wrote:
> On Mar 17, 1:49 pm, Aaron Brady wrote:
>
>
>
> > You would need a unique attribute to look for on values in the
> > dictionary, which means you'd need to detect what functions you are
> > renaming; possibly by using a decorator to mark them. (Untested:)
>
> > cl
Adam wrote:
> David, would you believe that I just posted about this very idea, It
> doesn't seem to have shown up yet, though. This idea works from the
> perspective of being trivially easy to implement. I can easily write
> a metaclass that looks in the namespace for methods with names that
>
Adam wrote:
> Hey, Cliff. Thanks for sharing this idea. Unfortunately, providing a
> way to actually call the method with the mangled name is relatively
> easy, and there are options there. The real issue, to me, seems to be
> finding a way to prevent Python from eating all but the last version
On Mar 18, 4:18 pm, Adam wrote:
> Hey, Cliff. Thanks for sharing this idea. Unfortunately, providing a
> way to actually call the method with the mangled name is relatively
> easy, and there are options there. The real issue, to me, seems to be
> finding a way to prevent Python from eating all
On Mar 18, 11:11 am, "R. David Murray" wrote:
> I don't have any wisdom on the metaclass/decorator stuff, but what
> about slightly reformulating the interface? Instead of having the
> programmer type, eg:
>
> @GET
> def foo(self): pass
>
> @POST
> def foo(self): pass
>
> have the
On Mar 18, 10:33 am, "J. Cliff Dyer" wrote:
> You might be interested in redefining __getattribute__(self, attr) on
> your class. This could operate in conjunction with the hash tables
> (dictionaries) mentioned by andrew cooke. i.e. (untested code):
>
> class C(object):
> def __init__(self)
> class foo_controller(Controller):
> __metaclass__= ControllerMetaclass
> def __init__(self, action, method = None):
> self.action = action
> self.method = method
>
>
> def foo(self):
> print "in foo()"
>
> @get_only
> def foo(self):
> print "
You might be interested in redefining __getattribute__(self, attr) on
your class. This could operate in conjunction with the hash tables
(dictionaries) mentioned by andrew cooke. i.e. (untested code):
class C(object):
def __init__(self):
self._get_table = {}
self._post_table
On Mar 17, 1:49 pm, Aaron Brady wrote:
> You would need a unique attribute to look for on values in the
> dictionary, which means you'd need to detect what functions you are
> renaming; possibly by using a decorator to mark them. (Untested:)
>
> class X( metaclass= M ):
> @mark( 'A' )
> def
I forgot; people interested in metaclasses in Python 3.0
will want to read this paper:
http://www.artima.com/weblogs/viewpost.jsp?thread=236234
--
http://mail.python.org/mailman/listinfo/python-list
On Mar 17, 7:45 pm, Aaron Brady wrote:
> (Perhaps someday, we will be able to write:
> def dec( namespace ):
> def outer( fun ):
> if fun.__name__ in namespace:
> namespace[ dup_var ]= namespace[ fun.__name__ ]
> return fun
> return outer
> It allows us to see if there's a prior
at bottom
On Mar 17, 12:54 pm, "andrew cooke" wrote:
> ah, ok. then yes, you can do that with decorators. you'd need hash
> tables or something similar in a metaclass. then the decorator would take
> the given function, stick it in the appropriate hash table, and return a
> function that does t
ah, ok. then yes, you can do that with decorators. you'd need hash
tables or something similar in a metaclass. then the decorator would take
the given function, stick it in the appropriate hash table, and return a
function that does the dispatch (ie at run time does the lookup from the
hash tab
On Mar 17, 12:20 pm, Adam wrote:
> Thanks, Andrew. I'm trying to accomplish something with a
> metaprogramming flavor, where, for the convenience of the programmer
> and the clarity of code, I'd like to have a decorator or some other
> mechanism do twiddling behind the scenes to make a class do s
Thanks, Andrew. I'm trying to accomplish something with a
metaprogramming flavor, where, for the convenience of the programmer
and the clarity of code, I'd like to have a decorator or some other
mechanism do twiddling behind the scenes to make a class do something
it wouldn't normally do.
Here's
Adam wrote:
> class A(object):
> def __init__(self, method, usebar = False):
> self.method = method
> self.usebar = usebar
>
> def __call__(self):
> if self.usebar == True:
> mangled_name = "_bar_" + self.method
> if hasattr(self, mangled_name
I am using Python 2.5, and I would like to write a decorator (or using
some other elegant, declarative approach) to mangle the name of
function in a class. I would like to be able to have two methods
declared with the same name, but one of them will have a decorator (or
whatever) that will change
Linuxguy123 wrote:
> Excuse my ignorance, but is there a limit to the size of function names
> in Python ?
>
> I named a function getSynclientVersion() and I got an error when I
> called it.
No no, don't tell us what error you got! I love guessing games. I'm guessing
you got either a SyntaxErr
On Sat, 2009-02-14 at 07:45 -0700, Linuxguy123 wrote:
> Excuse my ignorance, but is there a limit to the size of function names
> in Python ?
>
> I named a function getSynclientVersion() and I got an error when I
> called it.
You forgot to paste the error.
--
http://mail.python.org/mailman/lis
> fine.
>
> Why ?
>
Hello again, Linuxguy123! I see you are forging ahead in your quest
for Python knowledge.
Here is a small snippet that refutes your assertion that function name
length is a problem (but surely, you could have written this small a
test and answered your own question...
Linuxguy123 wrote:
Excuse my ignorance, but is there a limit to the size of function names
in Python ?
I named a function getSynclientVersion() and I got an error when I
called it. I renamed the same function to getSCVersion() and it called
fine.
Why ?
Probably a just spelling mistake. Double
Excuse my ignorance, but is there a limit to the size of function names
in Python ?
I named a function getSynclientVersion() and I got an error when I
called it. I renamed the same function to getSCVersion() and it called
fine.
Why ?
Thanks
--
http://mail.python.org/mailman/listinfo/python-lis
Sure!
Make a dictionary:
fdict = {"A":fa, "B":fb, ... }
Then consider
x = "A"
result = fdict(x)(param1, param2)
should call fa without any if's...
Gerry
--
http://mail.pytho
On Apr 30, 11:05 am, Arnaud Delobelle <[EMAIL PROTECTED]> wrote:
> TkNeo<[EMAIL PROTECTED]> writes:
>
> > George - Thanks for your reply but what you suggested is not working:
>
> > def FA(param1,param2):
> > print "FA" + param1 + " " + param2
> > def FA(param1,param2):
> > print "FB" + par
"thinkofwhy" <[EMAIL PROTECTED]> wrote:
> Try a dictionary:
>
> def funcA(blah, blah)
> def funcB(blah, blah)
> def funcC(blah, blah)
> functions = {'A': funcA, 'B': funcB, 'C':
> funcC}
> user_func = 'A'
> functions[user_func] #execute function
Python has a neat concept
Try a dictionary:
def funcA(blah, blah)
def funcB(blah, blah)
def funcC(blah, blah)
functions = {'A': funcA, 'B': funcB, 'C':
funcC}
user_func = 'A'
functions[user_func] #execute function
"Arnaud Delobelle" <[EMAIL PROTECTED]> wrote
in message news:[EMAIL PROTECTED]
TkNeo
TkNeo <[EMAIL PROTECTED]> writes:
>
> George - Thanks for your reply but what you suggested is not working:
>
> def FA(param1,param2):
> print "FA" + param1 + " " + param2
> def FA(param1,param2):
> print "FB" + param1 + " " + param2
> def FA(param1,param2):
> print "FC" + param1 + " "
On Apr 8, 7:51 pm, George Sakkis <[EMAIL PROTECTED]> wrote:
> On Apr 8, 3:52 pm,TkNeo<[EMAIL PROTECTED]> wrote:
>
> > I don't know the exact terminology in python, but this is something i
> > am trying to do
>
> > i have 3 functions lets say
> > FA(param1,param2)
> > FB(param1,param2)
> > FC(param1
1 - 100 of 134 matches
Mail list logo