Le 02-12-2013, Steven D'Aprano 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.
Regards, G.
--
h
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 c
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
> 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 s
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:
http://grokbase.com/t/python/python-list/033r5nks47/type-function-does-not-subtype#20030324rcnwbkfedhzba
Le 01-12-2013, Gary Herron 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, indeed. The 'function' built-
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
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"
Le 01-12-2013, Roy Smith a écrit :
>
> class foo(type(open)):
> pass
>
> I get:
>
> Traceback (most recent call last):
> File "", line 1, in
> TypeError: Error when calling the metaclass bases
> type 'builtin_function_or_method' is not an acceptable base type
>
> So, we're back to askin
In article <529b8ba2$0$2270$426a7...@news.free.fr>,
"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.
It really helps to g
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
11 matches
Mail list logo