Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 29181

Python is a dynamically typed, high-level interpreted programming language. Its design focuses on clear syntax, an intuitive approach to object-oriented programming, and making the right way to do things obvious. Python supports modules and exceptions, and has an extensive standard module library. Python is general-purpose and thus used widely, from the web to embedded systems.

2 votes

Is ad-hoc polymorphism a good practice in functional programming?

The difference is that in Python the type is always part of a value's runtime representation, so you might as well use it for the branch selection, whereas in Haskell types are normally erased at runtime … toX = fromAtoX instance XAble B where toX = fromBtoX instance XAble C where toX = fromCtoX In this case, there is no need to wrap the values, however this is in practice quite different from how your Python
leftaroundabout's user avatar
2 votes

Does subclassing int to forbid negative integers break Liskov Substitution Principle?

First of all, talking about something like this within Python is a bit like debating what sharpening technique works best on butter knifes, and then you also don't specify what int means to you, in its … In C# and moreso in Python you could get around these issues by changing the result type ad-hoc: the subclass + operator could just always return a PositiveInt, whereas the - operator could return a PostiveInt …
leftaroundabout's user avatar