I've been thinking a small amount concerning macros and what use they may be in Python. Basically, i used to be considering writing AN import hook that may permit you to use code quoting and unquoting and stuff for your Python modules. My motive was simply that Lisp folks appear to rave concerning however impressive macros square measure all the time, thus I patterned they need to be cool.
As I Sabbatum all the way down to really begin deciding what macro definitions and uses ought to seem like in Python training, I thought, hey, i am going to simply throw along a use case. however i have not been able to come back up with one (yet).
Most of the examples I found on the online targeted on "hey, you'll implement a 'while' loop with macros in Lisp!" or "hey, inspect all the cool stuff the 'setf' macro will do!" thus I began to wonder if perhaps Lisp folks love macros as a result of it permits them to increase Lisp's minimalist syntax with new constructs (like object-oriented programming with CLOS, whereas loops, etc.) Python, OTOH, has pretty wealthy syntax. it's a pleasant OOP system with grammar support, whereas and for loops, generators, iterators, context managers, primitive coroutines, comprehensions, destructuring bind,.... -- What would i take advantage of macros for? (OK, reckoning on the syntax, I might add a "switch" statement, however that hardly appears definitely worth the bother.)
If you are interested to learn python certification please go through python training
I ought to mention that I additionally saw some samples of folks victimisation macros for performance; you essentially get eliminate a call and you'll probably create the inner loop of some important perform run extremely quick. however if that is all it buys Pine Tree State in Python-land (well, that and a switch statement), my motivation is pretty low. as a result of let's face it -- if your important inner loop is written in pure Python, you'll pretty simply throw it at Cython and obtain higher performance than Python macros might ever offer.
So here's the question: will anyone out there have a thought of what macros would increase Python's power or expressiveness? or even some Lisp, Meta OCAML, or example Haskell hackers WHO will enlighten Pine Tree State on what macros will increase a language with already wealthy syntax? For more information python online training
As I Sabbatum all the way down to really begin deciding what macro definitions and uses ought to seem like in Python training, I thought, hey, i am going to simply throw along a use case. however i have not been able to come back up with one (yet).
Most of the examples I found on the online targeted on "hey, you'll implement a 'while' loop with macros in Lisp!" or "hey, inspect all the cool stuff the 'setf' macro will do!" thus I began to wonder if perhaps Lisp folks love macros as a result of it permits them to increase Lisp's minimalist syntax with new constructs (like object-oriented programming with CLOS, whereas loops, etc.) Python, OTOH, has pretty wealthy syntax. it's a pleasant OOP system with grammar support, whereas and for loops, generators, iterators, context managers, primitive coroutines, comprehensions, destructuring bind,.... -- What would i take advantage of macros for? (OK, reckoning on the syntax, I might add a "switch" statement, however that hardly appears definitely worth the bother.)
If you are interested to learn python certification please go through python training
I ought to mention that I additionally saw some samples of folks victimisation macros for performance; you essentially get eliminate a call and you'll probably create the inner loop of some important perform run extremely quick. however if that is all it buys Pine Tree State in Python-land (well, that and a switch statement), my motivation is pretty low. as a result of let's face it -- if your important inner loop is written in pure Python, you'll pretty simply throw it at Cython and obtain higher performance than Python macros might ever offer.
So here's the question: will anyone out there have a thought of what macros would increase Python's power or expressiveness? or even some Lisp, Meta OCAML, or example Haskell hackers WHO will enlighten Pine Tree State on what macros will increase a language with already wealthy syntax? For more information python online training
1 comment:
This is a really informative knowledge, Thanks for posting this informative Information. Learn Python Online
Post a Comment