Hans Mulder wrote:
> There's also: hasattr(, '__call__'). It works in both 2.x and 3.x.
Good work, Hans. I do find that to be a more pythonic approach,
personally, being more concerned with an object's ability than its
abstract type.
--
http://mail.python.org/mailman/listinfo/python-list
alex23 wrote:
Stephen Hansen wrote:
P.S. The removal of callable is something I don't understand in Python
3: while generally speaking I do really believe and use duck typing, I
too have on occassion wanted to dispatch based on 'is callable? do x'.
Sometimes its not convenient to do so via duck
On 6/27/10 10:09 PM, alex23 wrote:
Stephen Hansen wrote:
What the hell? When did that show up? o.O (Did I not pay attention
enough during the ABC conversations? It seemed so boring).
The PEPs& post-release docs detailing Py3 changes were worth reading,
it's noted in the sections on changes t
On Sun, Jun 27, 2010 at 9:54 PM, Stephen Hansen
wrote:
> On 6/27/10 9:30 PM, alex23 wrote:
>> Stephen Hansen wrote:
>>> P.S. The removal of callable is something I don't understand in Python
>>> 3: while generally speaking I do really believe and use duck typing, I
>>> too have on occassion wante
Stephen Hansen wrote:
> What the hell? When did that show up? o.O (Did I not pay attention
> enough during the ABC conversations? It seemed so boring).
The PEPs & post-release docs detailing Py3 changes were worth reading,
it's noted in the sections on changes to built-ins:
http://www.python.org
On 6/27/10 9:47 PM, Chris Rebert wrote:
There's always: isinstance(, collections.Callable)
Why in Guido's name is that in the collections module of all places?
What hath callability to do with container objects?
What he said! Minus the blasphemy.
It's Benevolent _Dictator_ For Life. Not Bene
On 6/27/10 9:30 PM, alex23 wrote:
Stephen Hansen wrote:
P.S. The removal of callable is something I don't understand in Python
3: while generally speaking I do really believe and use duck typing, I
too have on occassion wanted to dispatch based on 'is callable? do x'.
Sometimes its not convenie
On Sun, Jun 27, 2010 at 9:30 PM, alex23 wrote:
> Stephen Hansen wrote:
>> P.S. The removal of callable is something I don't understand in Python
>> 3: while generally speaking I do really believe and use duck typing, I
>> too have on occassion wanted to dispatch based on 'is callable? do x'.
>> S
Stephen Hansen wrote:
> P.S. The removal of callable is something I don't understand in Python
> 3: while generally speaking I do really believe and use duck typing, I
> too have on occassion wanted to dispatch based on 'is callable? do x'.
> Sometimes its not convenient to do so via duck typing.
On 6/27/10 8:04 PM, Steven W. Orr wrote:
On 6/27/2010 10:25 PM, Stephen Hansen wrote:
On 6/27/10 7:09 PM, Steven W. Orr wrote:
So, my question is, what value can I use as the 2nd arg to isinstance
to see if
foo is a function? And while I'm on the subject, what types does
isinstance not
support?
On 6/27/2010 10:25 PM, Stephen Hansen wrote:
> On 6/27/10 7:09 PM, Steven W. Orr wrote:
>> So, my question is, what value can I use as the 2nd arg to isinstance
>> to see if
>> foo is a function? And while I'm on the subject, what types does
>> isinstance not
>> support?
>
> Does it have to be a f
Steven W. Orr wrote:
I need to test an argument for a few different types.
I'm calling my function like this
arf = MyFunc(list)
What I want to do is to test for whether something is a string, tuple, list or
function. It's that last one that's causing me a problem.
if isinstance(arg, (str, tup
On 6/27/10 7:09 PM, Steven W. Orr wrote:
So, my question is, what value can I use as the 2nd arg to isinstance to see if
foo is a function? And while I'm on the subject, what types does isinstance not
support?
Does it have to be a function? -- There's quite a few things which are
function-y en
I need to test an argument for a few different types.
I'm calling my function like this
arf = MyFunc(list)
What I want to do is to test for whether something is a string, tuple, list or
function. It's that last one that's causing me a problem.
if isinstance(arg, (str, tuple, list)):
No problem
14 matches
Mail list logo