3 ms·
Closer, but int can throw a ValueError. The original Haskell code defaulted to the defaultPort if the specified port could not be cast to an int.
by daenz 7y ago
Closer, but int can throw a ValueError. The original Haskell code defaulted to the defaultPort if the specified port could not be cast to an int.
- icedchai 7y agoI see. Though I think it's better to throw an error. I wouldn't want my app just coming up on default port if I had configured it incorrectly.
- KirinDave 7y agoIt might be in Python, but it's sorta oranges to apples for you to just not do the same thing your Rosetta code is supposed to do. What's the value of your exercise if you just redefine the problem to get rid of the tricky part?
- icedchai 7y agoI’d say the original code was wrong. anyway catching an exception isn’t tricky.
- KirinDave 7y agoIf it's easy then why did you fail twice at even making a valid python expression? When we talk about the oppressive nature of Python culture—how the "there is only one way to do it" culture leaks out of the place where it's applicable and starts to be focused on other communities that have different requirements—we think of examples like this. "Your code in a language I don't now or use is wrong." Over focusing on how the example code polls the environment is the least interesting thing you could hyperfocus on. What's more, I think it's a bit more normal to use something like optparse-applicative, which leads to inevitable complaints about using infix operators that every Haskell novice knows but that armchair Haskell programmers hem and haw about asking, "is this too many operators?"