On Sun, 25 Sep 2005 09:30:30 +0100, Catalin Marinas <[EMAIL PROTECTED]> wrote:
>Hi,
>
>Sorry if this was previously discussed but it's something I miss in
>Python. I get around this using isinstance() but it would be cleaner
>to have separate functions with the same name but different argument
>ty
In article <[EMAIL PROTECTED]>,
Catalin Marinas <[EMAIL PROTECTED]> wrote:
...
> Of course, duck-typing is simple to use but the parametric
> polymorphism is useful when the types are unrelated. Let's say you
> want to implement a colour-print function which should support basic
> types like ints
Tom Anderson <[EMAIL PROTECTED]> wrote:
> Is there any reason you have to stringify the type signature? Types
> are hashable, so a tuple of types is hashable, so you can just use
> that as a key. Replace "methods[f.func_name][str(types)] = f" with
> "methods[f.func_name][types] = f" and "type_str =
On Sun, 25 Sep 2005, Catalin Marinas wrote:
> Sorry if this was previously discussed but it's something I miss in
> Python. I get around this using isinstance() but it would be cleaner to
> have separate functions with the same name but different argument types.
> I think the idea gets quite cl
Catalin Marinas wrote:
> Sorry if this was previously discussed but it's something I miss in
> Python. I get around this using isinstance() but it would be cleaner
> to have separate functions with the same name but different argument
> types. I think the idea gets quite close to the Lisp/CLOS
> im
"Diez B. Roggisch" <[EMAIL PROTECTED]> wrote:
> google for gnosis utils and multimethods to see a more "oldfashioned"
> implementation.
I now remember to have seen it but it requires a lot of typing to
achieve it and you would call a different function name from the one
you define, reducing the co
Catalin Marinas wrote:
> Hi,
>
> Sorry if this was previously discussed but it's something I miss in
> Python. I get around this using isinstance() but it would be cleaner
> to have separate functions with the same name but different argument
> types. I think the idea gets quite close to the Lisp/
Hi,
Sorry if this was previously discussed but it's something I miss in
Python. I get around this using isinstance() but it would be cleaner
to have separate functions with the same name but different argument
types. I think the idea gets quite close to the Lisp/CLOS
implementation of methods.
Be