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


99
6
avatar Nevenka pre 19 dana
1
avatar Ivana pre 27 dana
1
avatar Marko pre 38 dana
4
avatar Daniela pre 82 dana
6
12
avatar Nikola pre 84 dana
13
4
avatar Vukašin pre 98 dana
5
avatar Vukašin pre 119 dana
2
avatar Vukašin pre 136 dana
21
avatar Vukašin pre 137 dana
4
avatar Djordje pre 139 dana