Skip to content

Commit 654526f

Browse files
committed
-
1 parent 4d69708 commit 654526f

File tree

4 files changed

+3
-22
lines changed

4 files changed

+3
-22
lines changed

source_py3/python_toolbox/misc_tools/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from .misc_tools import (
77
is_subclass, get_mro_depth_of_method, frange, getted_vars,
88
_ascii_variable_pattern, is_legal_ascii_variable_name,
9-
is_magic_variable_name, get_actual_type, is_number, identity_function,
9+
is_magic_variable_name, is_number, identity_function,
1010
do_nothing, OwnNameDiscoveringDescriptor, find_clear_place_on_circle,
1111
general_sum, general_product, is_legal_email_address, is_type
1212
)

source_py3/python_toolbox/misc_tools/misc_tools.py

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -117,25 +117,6 @@ def is_magic_variable_name(name):
117117
name[:2] == name[-2:] == '__'
118118

119119

120-
def get_actual_type(thing):
121-
'''
122-
Get the actual type (or class) of an object.
123-
124-
This is used instead of `type(thing)` for compaibility with old-style
125-
classes.
126-
'''
127-
128-
return getattr(thing, '__class__', None) or type(thing)
129-
# Using `.__class__` instead of `type` because of goddamned old-style
130-
# classes. When you do `type` on an instance of an old-style class, you
131-
# just get the useless `InstanceType`. But wait, there's more! We can't
132-
# just take `thing.__class__` because the old-style classes themselves,
133-
# i.e. the classes and not the instances, do not have a `.__class__`
134-
# attribute at all! Therefore we are using `type` as a fallback.
135-
#
136-
# I don't like old-style classes, that's what I'm saying.
137-
138-
139120
def is_number(x):
140121
'''Return whether `x` is a number.'''
141122
try:

source_py3/python_toolbox/monkeypatching_tools.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def my_method(a):
3838

3939
monkeypatchee_is_a_class = misc_tools.is_type(monkeypatchee)
4040
class_of_monkeypatchee = monkeypatchee if monkeypatchee_is_a_class else \
41-
misc_tools.get_actual_type(monkeypatchee)
41+
type(monkeypatchee)
4242

4343
def decorator(function):
4444
# Note that unlike most decorators, this decorator retuns the function

source_py3/python_toolbox/pickle_tools.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def is_atomically_pickleable(thing):
2626
2727
However, the `threading.Lock()` itself is not atomically pickleable.
2828
'''
29-
my_type = misc_tools.get_actual_type(thing)
29+
my_type = type(thing)
3030
return _is_type_atomically_pickleable(my_type, thing)
3131

3232

0 commit comments

Comments
 (0)