Holla, single dispatch generic function, hmmm ça me laisse songeur. Les "Lispers" (espece en voie de disparition sur cette liste) ont surement deja entendu parler de "generic functions" ou comment ecrire une fonction ayant "plusieurs" :-) corps
L'execution sera fonction d'un ou des arguments passés en parametre de la fonction. Interessant en effet. @+ On 9/30/13, Alioune Dia <[email protected]> wrote: > Bonjour La nouvelle version de langage de programmation Python vient de > sortir > et est phase de test disponible ici: > > 2013/9/30 Larry Hastings <[email protected]>: >> On behalf of the Python development team, I'm pleased to announce the >> third alpha release of Python 3.4. >> >> This is a preview release, and its use is not recommended for >> production settings. >> >> Python 3.4 includes a range of improvements of the 3.x series, including >> hundreds of small improvements and bug fixes. Major new features and >> changes in the 3.4 release series so far include: >> >> * PEP 435, a standardized "enum" module >> * PEP 442, improved semantics for object finalization >> * PEP 443, adding single-dispatch generic functions to the standard >> library >> * PEP 445, a new C API for implementing custom memory allocators >> * PEP 446, changing file descriptors to not be inherited by default >> in subprocesses >> >> >> To download Python 3.4.0a3 visit: >> >> http://www.python.org/download/releases/3.4.0/ >> >> >> Please consider trying Python 3.4.0a3 with your code and reporting any >> issues you notice to: >> >> http://bugs.python.org/ >> >> >> Enjoy! >> > > > Sur cette nouvelle version quelques amélioration du langage de > programmation > tels que : > > -- * PEP 443, adding single-dispatch generic functions to the standard > library > > Dans les versions anciennes de Python , le developpeur etait obligé lui > meme > de faire de l'introspection sur les arguments passés a la fonction > pour determiner > le types et traiter en consequence . ce qui est anti-pattern. > > def do(args): > if type(args) == list : > .print 'List' > elif type(args) == """: > print 'String' > elif type(args)== None: > print 'None' > > Sur cette nouvelle version vous avez la possibilité d'utiliser la > nouvelle fonctionnalité > singledispatch > > @singledispatch > def do(args): > print 'Let me dispatch' > > @do.register(list) > def _(arg, verbose=False): > print 'List' > > @do.register(list) > def _(arg, verbose=False): > print 'List' > > > --- PEP 435, a standardized "enum" module > > Un nouveau Type Enum. > > Toutes ces nouvelles modifications peuvent etre vu ici sur le site > officiel de cet > exeptionnel langage de programmation > http://www.python.org/download/releases/3.4.0/ > > -- > Ce message a été envoyé à la liste [email protected] > Gestion de votre abonnement : http://dakarlug.org/liste > Archives : http://news.gmane.org/gmane.org.user-groups.linux.dakarlug > Le site du DakarLUG : http://dakarlug.org > -- Bests, --- "Still water is deep" Patrick Nsukami http://about.me/lemeteore -- Ce message a été envoyé à la liste [email protected] Gestion de votre abonnement : http://dakarlug.org/liste Archives : http://news.gmane.org/gmane.org.user-groups.linux.dakarlug Le site du DakarLUG : http://dakarlug.org
