miniblog.
← Back to all posts
Sep 17, 2013 at 17:45
I've actually used metaclasses today! Ensuring a #Python class is never instantiated twice with the same arguments:
Ensure no class gets instantiated twice with the same arguments.
Ensure no class gets instantiated twice with the same arguments. - cached_instances.py
Wilfred Hughes
Related Posts
Apr 23, 2013 at 16:14
Abusing metaclasses to avoid adding a self argument to methods:
https://www.voidspace.org.uk/python/articles/metaclasses.shtml#the-selfless-metaclass
#python (not advisable in practice!)
Wilfred Hughes
Shared words: metaclasses, Python, arguments Score: 65.5
Mar 23, 2013 at 13:22
Used #Python metaclasses in anger yesterday -- as with most metaprogramming, usually a bad idea, but occasionally a huge boon.
Wilfred Hughes
Shared words: metaclasses, used, Python Score: 62.6
Mar 21, 2014 at 20:39
I actually needed a try-else statement in Python today! I believe this is the first time I've used it in anger.
Wilfred Hughes
Shared words: actually, used, today, Python Score: 61.2