Top "Duck-typing" questions

In Duck Typing, an object's methods and properties determine its valid semantics rather than its membership in a particular class or its interface.

what is the right way to treat Python argparse.Namespace() as a dictionary?

If I want to use the results of argparse.ArgumentParser(), which is a Namespace object, with a method that expects …

python dictionary duck-typing
What is duck typing?

I came across the term duck typing while reading random topics on software online and did not completely understand it. …

programming-languages duck-typing
How to identify numpy types in python?

How can one reliably determine if an object has a numpy type? I realize that this question goes against the …

python numpy duck-typing dynamic-typing
Ruby class types and case statements

What is the difference between case item.class when MyClass # do something here when Array # do something different here when …

ruby duck-typing case-statement
Using LINQ, is it possible to output a dynamic object from a Select statement? If so, how?

Presently in LINQ, the following compiles and works just fine: var listOfFoo = myData.Select(x => new FooModel{ someProperty = x.…

c# .net dynamic duck-typing expandoobject
What's an example of duck typing in Java?

I just recently heard of duck typing and I read the Wikipedia article about it, but I'm having a hard …

java duck-typing
Is this duck-typing in Python?

Here is some Ruby code: class Duck def help puts "Quaaaaaack!" end end class Person def help puts "Heeeelp!" end …

python python-3.x duck-typing
How do Ruby programmers do type checking?

Since there is no type in ruby, how do Ruby programmers make sure a function receives correct arguments? Right now, …

ruby oop duck-typing
boolean subtract DeprecationWarning

I recently upgraded to numpy 1.9dev. (For improved OpenBlas support). I have some code that does x-y Where x and …

python numpy duck-typing
What is the difference between polymorphism and duck typing?

I'm a little confused with the two terms, here's what I know: Polymorphism is the ability of object of different …

oop polymorphism duck-typing