[Python-ideas] ML Style Pattern Matching for Python

Ian Bicking ianb at colorstudy.com
Sat Dec 18 20:18:59 CET 2010


I don't have any real opinion on this, but this old experiment seems related
to the discussion: http://svn.colorstudy.com/home/ianb/recipes/patmatch.py

--
Sent from a phone

On Dec 18, 2010 12:30 PM, "Eike Welk" <eike.welk at gmx.net> wrote:

On Saturday 18.12.2010 18:34:57 Georg Brandl wrote:
> Am 18.12.2010 12:23, schrieb Eike Welk:
> > In...
Yes, it's a bit of fun. This would never get into Python anyway, but I'd
like
it nevertheless. (It is Ocaml's record syntax with some small tweaks.)

It would be possible to realize it though. With "inspect.getfullargspec" you
can see the a function's signature. There might be problems with efficiency,
because you'd have to search through globals and locals repeatedly. You you
could however store which class matched, somewhere in the code object.

Storing this kind of information would go against Python's nature as a
dynamic
language, even though it would work as expected in 99% of the use cases. Oh
well ...


Eike

_______________________________________________
Python-ideas mailing list
Python-ideas at python.org
ht...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20101218/a36ce2ed/attachment.html>


More information about the Python-ideas mailing list