mirror of
https://github.com/python/cpython.git
synced 2025-10-21 14:12:27 +00:00
No need for types, use isinstance
This commit is contained in:
parent
f9232678ae
commit
d752f7d8e8
3 changed files with 6 additions and 9 deletions
|
@ -1,9 +1,8 @@
|
|||
import types
|
||||
|
||||
def flatten(tup):
|
||||
elts = []
|
||||
for elt in tup:
|
||||
if type(elt) == types.TupleType:
|
||||
if isinstance(elt, tuple):
|
||||
elts = elts + flatten(elt)
|
||||
else:
|
||||
elts.append(elt)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue