Le 02-12-2013, Steven D'Aprano st...@pearwood.info a écrit :
There are plenty of ways to extend functions. Subclassing isn't one of
them.
Thank you very mych for your complete answer; I falled back to your last
proposal by myself in my attempts; I am happyt to learn about the other ways
also.
Hi, I can't figure out how I can extend the 'function' built-in class. I tried:
class test(function):
def test(self):
print(test)
but I get an error. Is it possible ?
Regards, G.
--
https://mail.python.org/mailman/listinfo/python-list
In article 529b8ba2$0$2270$426a7...@news.free.fr,
G. gru...@grumsk.tz wrote:
Hi, I can't figure out how I can extend the 'function' built-in class. I
tried:
class test(function):
def test(self):
print(test)
but I get an error. Is it possible ?
Regards, G.
It really helps
Le 01-12-2013, Roy Smith r...@panix.com a écrit :
class foo(type(open)):
pass
I get:
Traceback (most recent call last):
File stdin, line 1, in module
TypeError: Error when calling the metaclass bases
type 'builtin_function_or_method' is not an acceptable base type
So, we're
On 2013-12-01 19:18, G. wrote:
Hi, I can't figure out how I can extend the 'function' built-in
class. I tried: class test(function):
def test(self):
print(test)
but I get an error. Is it possible ?
While I don't have an answer, I did find this interesting. First,
function doesn't
On 12/01/2013 11:18 AM, G. wrote:
Hi, I can't figure out how I can extend the 'function' built-in class. I tried:
class test(function):
def test(self):
print(test)
but I get an error. Is it possible ?
Regards, G.
What error do you get?
What version of Python?
What OS?
And in
Le 01-12-2013, Gary Herron gary.her...@islandtraining.com a écrit :
And in particular: What 'function' built-in class? I know of no such
thing, and the error message I get with your code says exactly that:
NameError: name 'function' is not defined
Did you not get that same error?
Yes,
On 2013-12-01 19:43, Tim Chase wrote:
I'm not quite sure *why* one might want to subclass FunctionType, but
I'm also not sure why you should be *prevented* from subclassing it.
Previously:
Hi, I can't figure out how I can extend the 'function' built-in class. I
tried:
class test(function):
def test(self):
print(test)
but I get an error. Is it possible ?
It has to do with differing models of computation, and python isn't
designed for this. Perhaps you're
On 2/12/2013 5:18 AM, G. wrote:
Hi, I can't figure out how I can extend the 'function' built-in class. I tried:
class test(function):
def test(self):
print(test)
but I get an error. Is it possible ?
Others have pointed out that you cannot subclass the function type.
Could you
On Sun, 01 Dec 2013 19:18:58 +, G. wrote:
Hi, I can't figure out how I can extend the 'function' built-in class. I
tried:
class test(function):
def test(self):
print(test)
but I get an error. Is it possible ?
You cannot subclass the function type directly, but you can
11 matches
Mail list logo