Metaprogramming in Python
developer.ibm.com
Metaprogramming in Python
1–10 of 61 posts
Re: Metaprogramming in Python
#2https://docs.python.org/3/reference/datamodel.html#object.__...
Re: Metaprogramming in Python
#3Thanks for sharing! Instead of using meta classes for subclass registration though, please just use __subclass_init__ instead. It’ll often be simpler unless you have a complex use case. https://docs.python.org/3/reference/datamodel.html#object.__...
And metaclasses can be any callable, not just class. It's usually better to use a simple function.
Re: Metaprogramming in Python
#4We define the instance as: someobject = SomeClass()
but then we refer to it as someobj and some_object
Re: Metaprogramming in Python
#5Re: Metaprogramming in Python
#6And with the recent addition of new syntax, I would hardly call Python easy.
Re: Metaprogramming in Python
#7It is shocking how much vodoo magic there is in a programming language marketed as "easy to learn and use". And with the recent addition of new syntax, I would hardly call Python easy.
Most python programmer use 10% of the language, the same 10% that is described in most tutorial, because that's enough, and they don't even know the rest exist.
This makes for a very smooth, but long learning curve which allow you to enjoy python in the early years, yet keep getting a kick out of it after 15 years.
I hear a lot of people raising the same kind of concern you do in comments, but in the field, I never do with people actually using the language.
Re: Metaprogramming in Python
#8Re: Metaprogramming in Python
#9It is shocking how much vodoo magic there is in a programming language marketed as "easy to learn and use". And with the recent addition of new syntax, I would hardly call Python easy.
But that's exactly what that expression means?
A car with an automatic transmission is "easy to learn and use", but an automatic transmission is way more complicated to construct than a manual one.
Re: Metaprogramming in Python
#10It is shocking how much vodoo magic there is in a programming language marketed as "easy to learn and use". And with the recent addition of new syntax, I would hardly call Python easy.
Python is easy, not because it prevent people from doing complicated things, but because with only a few simple things, you are productive. Most python programmer use 10% of the language, the same 10% that is described in most tutorial, because that's enough, and they don't even know the rest exist. This makes for a very smooth, but long learning curve which allow you to enjoy python in the early years, yet keep gett…
Once you get thrown in a big project that makes heavy use of type hinting (plus the whole environment of it, mypy et all), Object Oriented design and all those hidden things...you realize how much you really don't know.
And that 10% is way too small. To be productive in Python, you need to know at least 50%, or you will be reinventing a lot of existing things. Poorly.