question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Hi.

running a grep in __metaclass__ with many usages in the new typing module I was for second thinking that you built metaclass support in(?) - but I got no success using them, e.g. __new__ is never called, no matter if I try py2 or py3 syntax. Also in the compiler for the ClassDef I see no code which would parse a metaclass=… statement.

=> I put this in as an enhancement request, thinking that maybe its not even very hard to support, at least to call their __new__ and assign the result of it, instead of calling the __class__ function to create a new js “class” ?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
AXGKlcommented, Oct 11, 2016

Hi,

I must admit that it sounds like an esoteric use case and hard to do - and ‘importance’ is always very subjective. In my specific case its the fact that I like to configure complex applications via nested classes, since this is a very readable format, almost like a DSL, exportable trivially to json but with all the features of cross referencing and most of all inheritance - and the python compiler already giving a lot of configuration errors. For this metaclasses are ideal to hook in some consistency checks and a lot of convenience shorthand features - don’t want to go too deep into that reasoning, since its really very subjective and your prios are Transcrypts prios, not mine.

=> Since I said it might be not so hard I’ll have a try to send you a PR when I have some time. As said to not bloat the code only the new would be enough, in order to modify the attributes and base classes in user space.

0reactions
JdeHcommented, Dec 24, 2016

Hi Gunther

Politically incorrect? I must have missed something… Probably it’s because I don’t watch the news too often, it just makes me sad.

It was a pleasure to cooperate with you and others on Transcrypt! Currently I am a bit tied up in a medical research project, but in the second half of januari I hope to be able to free time for TS again.

I wish you and your familiy a happy christmas and new year. We’ve come a long way in one year. I am contemplating ways to generate some more publicity for Transcrypt.

All the best. Jacques

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python Metaclasses - Real Python
Metaclasses are an esoteric OOP concept, lurking behind virtually all Python code. You are using them whether you are aware of it or...
Read more >
What are metaclasses in Python? - Stack Overflow
A metaclass is most commonly used as a class-factory. When you create an object by calling the class, Python creates a new class...
Read more >
Metaclass - Wikipedia
In object-oriented programming, a metaclass is a class whose instances are classes. Just as an ordinary class defines the behavior of certain objects, ......
Read more >
Metaclasses. The heart of Python | by Kasper Müller
That's because type is what is known as a metaclass. A metaclass instantiates classes just like classes instantiate objects.
Read more >
Metaprogramming with Metaclasses in Python - GeeksforGeeks
The metaclass is responsible for the generation of classes, so we can write our custom metaclasses to modify the way classes are generated...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found