SpeakinTelnet

joined 11 months ago
[–] SpeakinTelnet@programming.dev 1 points 9 months ago

It was added in 3.10 and is surprisingly complete. The tutorial pep is a good starting point to see what it can accomplish

[–] SpeakinTelnet@programming.dev 0 points 9 months ago* (last edited 9 months ago) (2 children)
def is_even(n):
    match n:
        case 1:
            return False
        case 0:
            return True
        # fix No1
        case n < 0:
            return is_even(-1*n)
        case _:
            return is_even(n-2)
[–] SpeakinTelnet@programming.dev 0 points 9 months ago (1 children)

I don't care how much you think your code is readable, plain text comments are readable by everyone no matter the proficiency in the programming language used. That alone can make a huge difference when you're just trying to understand how someone handled a situation.

view more: ‹ prev next ›