Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit46ad1c9

Browse files
committed
DOC: Use correct constructor for unit subclasses.
Use `object.__new__` was raising for _everything_ that wasn't an`object` (aka, everything in the examples). It's necessary to use theactual class's `__new__`, which fixes the special initialization thatwas in the `try`.
1 parent513c00b commit46ad1c9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

‎examples/units/basic_units.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ def __new__(cls, value, unit):
127127
methods['__getitem__']=cls._getitem
128128
subcls=type(f'TaggedValue_of_{value_class.__name__}',
129129
(cls,value_class),methods)
130-
returnobject.__new__(subcls)
130+
returnvalue_class.__new__(subcls)
131131
exceptTypeError:
132132
returnobject.__new__(cls)
133133

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp