twoframesperminute

joined 1 year ago
[–] twoframesperminute@mastodon.social -4 points 1 year ago (1 children)

@BeardedGingerWonder will you adapt your time to be 7 hours later?

Thought so.

[–] twoframesperminute@mastodon.social 0 points 1 year ago (1 children)

@sugar_in_your_tea Using asserts in any code except testing is frowned upon, afaik. You should use specific exceptions instead of vague unlabeled assertion errors.

You also seem to think that you're not allowed to use exception to communicate the fact a check failed. If that's the case, you're seriously underusing the power of exceptions.

It sounds a lot to me like you don't even want to use Python or think it shouldn't be used for anything serious. Why then even argue about it?

[–] twoframesperminute@mastodon.social 0 points 1 year ago (1 children)

@sugar_in_your_tea I don't think we should change any functionality when it comes to exception handling. Code based documentation would be great for type checking and auto-generated docs, but they can be done using annotations, not changed interfaces.

Monads are already possible, but should not be the normal way to code either. It's clunky and difficult to understand. It might work great for some scenarios, but doesn't for many others.

[–] twoframesperminute@mastodon.social 0 points 1 year ago (5 children)

@sugar_in_your_tea Since when is Python supposed to equal pseudo code? It should be easily readable, but that doesn't mean it should *equal* pseudo code.

You can either test for values being 0 before dividing, or catching an exception when it is. Especially when dividing multiple times in one function, I would go for the latter option.

[–] twoframesperminute@mastodon.social 0 points 1 year ago* (last edited 1 year ago) (7 children)

@sugar_in_your_tea But isn't all that possible in Python? Don't monads cover exactly what you want? Why does it need to be implemented some different way?

Also, divide by zero should be data just as well. Failing to program around having nothing to divide by is not a reason to have a program panic.

Also, having two systems for largely the same behavior doesn't seem to improve usability and clarity, in my opinion.

[–] twoframesperminute@mastodon.social 0 points 1 year ago (9 children)

@sugar_in_your_tea I'm by far not qualified to discuss this in depth. But it seems to me that almost every function call ever can fail. Therefore, do you need to do this with every single function call?

That seems terribly inefficient and bloated. How is that readable for anyone?

[–] twoframesperminute@mastodon.social 0 points 1 year ago (11 children)

@sugar_in_your_tea The idea of exceptions is that you can choose when to deal with them. So if you want to deal with them immediately,
nothing is stopping you.

If you think handling errors with every function call explicitly is easier, I guess you're using very few functions. For the project I'm working on, your proposal would probably double the number of lines. Thanks, but no thanks.

[–] twoframesperminute@mastodon.social 1 points 1 year ago (13 children)

@sugar_in_your_tea If you're expecting exceptions, make custom ones. That's the best way to distinguish between those you expect and those you don't. Using custom exceptions improves readability too.

@danielquinn agreed! You can work around the performance issues by wrapping it in a function.

[–] twoframesperminute@mastodon.social 0 points 1 year ago* (last edited 1 year ago) (1 children)

@nikaro iterable means: has __iter__() method. So there's no real difference, as far as I can see.

view more: ‹ prev next ›