I swear there's a lot of software engineering "best practices" out there that result from people talking themselves into believing that necessary workarounds weren't anti-patterns of a language's quirks but rather features of it.
-
-
In fact, I'd go so far as to argue that the try-except-else pattern is *fucking nonsense* that is at best a corruption of a different pattern to wallpaper over a hole in a wall.
Show this thread -
In case you're wondering why this is bad: - You're assigning a variable you intend to do nothing with - You're forcing yourself into eating an exception - If you want to check for actual exceptions, you need yet more code - try-except patterns aren't for type checking
Show this thread
End of conversation
New conversation -
-
-
well, no, it's not. the correct answer is "don't do that" :)
-
Alas, recent comments suggest it is *the* pattern to use :(
-
i mean, don't check at all; just iterate it and if the caller gave you garbage it's their problem
-
eh, not always a really practical approach
-
but more practical than a lot of people expect
-
for sure. It's just that for a lot of data sci stuff it can be irritating
-
I'm curious, can you give me an example so I can understand your use case better?
-
Ah, sure... implementig algorithms where things go from vector-like to scalar-like
- 2 more replies
New conversation -
-
-
this upsets me
- End of conversation
New conversation -
-
-
I suddenly like Python less.
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
suck typing
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
in any other language the second solution would be so sensible (s/ABC/interface/ but w/e), but Python... the MRO/multiple inheritance makes it undesirable, so we learn to "like" the former :( At least it's fixed in Python 3, per the answers above!
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
something like: those who sacrifice runtime type safety for ease of development deserve neither and lose both?
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
I swear Python is the middle brain in the exploding brain meme with small and large brains being compiled languages.
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.