Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 isinstance() arg2 is limited to a type or a tuple of types
#1
isinstance() arg2 is limited to a type or a tuple of types. it won't even accept a list of types.
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Quote
#2
I always use isinstance when I want to identify a particular type, not a range of types.
Quote
#3
what do you mean by "not a range of types"?

1. you use something else for a range of type.

2, you never do a range of types.
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Quote
#4
2. I rarely need it. When programming, I think binary.
Quote
#5
Any practical reason to supply container of container of types? It's either single type or multiple types in which case container (e.g. list, tuple, etc.) of types is enough. Just unpack your nested structure.

Sorry, I misread the question
Quote
#6
i coded this:
def istype(a,b):
    x=type(a)
    return x is b or x in b
in this function, arg2 can be any container type supported by the RHS of in.
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  isinstance() vs type() Skaperen 3 212 Oct-13-2019, 06:25 AM
Last Post: Gribouillis
  math.gcd() is limited to 2 arguments Skaperen 2 1,442 Aug-10-2019, 01:00 AM
Last Post: Skaperen
  Distributed size limited queue implementation? johsmi96 1 265 May-08-2019, 07:29 AM
Last Post: DeaD_EyE

Forum Jump:


Users browsing this thread: 1 Guest(s)