Nova verzija Python-a podržava switch-case izjave

https://rubikscode.net/2021/10/04/python-3-10-top-... link-img
avatar

Čitavu listu promena i feature-a možete naći ovde, a autor ovog teksta izdvojio je pet za koje smatra da će imati najviše uticaja. Među njima, nalazi se i Structural Pattern Matching koji će Python-u konačno omogućiti switch-case izjave. To znači da ako želite da proverite više vrednosti, sada postoji jednostavniji način.

Iz članka:

A new version of Python – Python 3.10.0 has been released. As usual with each Python release, there are several big topics and a couple of smaller features and in this article, we cover five which we think are going to make the biggest impact:

Structural Pattern Matching is definitely going to have the biggest impact. If you are familiar with a switch-case statement from any other language, this one is that, but on steroids. Python was not supporting switch-case statements, or similar concepts until now. There were several attempts to include this concept in the language, however, they were always rejected. The easiest way to use this new Python feature is to compare a variable with several values. There are two new keywords: match and case.

ULOGUJ SE I DODAJ KOMENTAR


Registruj ili prijavi.

VIDI POPULARNE POSTOVE


1
avatar Vukašin pre 67 dana
1
avatar Vukašin pre 79 dana
1
avatar Vukašin pre 83 dana
1
avatar Vukašin pre 85 dana
2
avatar Vukašin pre 93 dana
3
2
avatar Vukašin pre 98 dana
1
avatar Vukašin pre 98 dana
1
avatar Vukašin pre 100 dana
1
avatar Vukašin pre 100 dana
2
avatar Nevenka pre 101 dana