On 8 May 2012 19:31, xancorreu <xancor...@gmail.com> wrote: > A much pain for me. I think there should be a type.function avaliable in > python, like str, int, etc. exists. I think as python is O-O language and > have (or at least the page says that) higher-order function, I should could > type: >
Just define 'function' as being the type of (a) function. Any function will do. This will fix your problem eg: def main(): function = type(main) a = Tag("descripció", str, "primera tasca") b = Tag("unmes", function, lambda x: x+1) print(a) print(b) I used "main" but you can use whatever you like. It sounds to me however as though your type system may be (at least partially) independent of the real (python) type of whatever you're storing. If so, I'd actualy suggest you explicitly define your own type system and tag your objects accordingly. (E.g. create your own variant of the 'types' module and use those types as appropriate.) Walter
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor