Skip to content

Commit

Permalink
Optimize metaclass speed
Browse files Browse the repository at this point in the history
  • Loading branch information
penguinolog committed Feb 20, 2017
1 parent c8c2f71 commit a92a596
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions binfield/binfield.py
Expand Up @@ -430,6 +430,13 @@ def __new__(mcs, name, bases, classdict):

classdict['_cache_'] = {} # Use for subclasses memorize

if BinField not in bases:
return super(
BinFieldMeta,
mcs
).__new__(
mcs, name, bases, classdict)

# noinspection PyPep8Naming
RealMeta = type(
meta_name,
Expand All @@ -454,12 +461,6 @@ def __new__(smcs, sname, sbases, sns):

# pylint: enable=bad-mcs-classmethod-argument

if BinField not in bases:
return super(
BinFieldMeta,
mcs
).__new__(mcs, name, bases, classdict)

return SubMeta.__new__(SubMeta, name, bases, classdict)

@classmethod
Expand Down

0 comments on commit a92a596

Please sign in to comment.