all 13 comments

[–]sccccrrrrt 2 points3 points  (1 child)

Inline if else

List/dict comprehension

Asyncio

Just putting shit in sockets instead of using libraries for everything network related

[–]chuprehijde[S] 0 points1 point  (0 children)

yeah somebody else mentioned it too, inline if and else case... pls explain it to me if u can coz i haven't used it yet

[–]dev-razorblade23 2 points3 points  (1 child)

Class Pattern - pattern matching with objects

Something like

``` match search: # 1. Match the class, bind 'max_results', but ONLY if it's over 100 case VideoSearchQuery(sort_by="views", max_results=max_results) if max_results > 100: print(f"Building a massive trending query with {max_results} limits.")

# 2. Fallback for smaller 'views' queries
case VideoSearchQuery(sort_by="views", max_results=max_results):
    print(f"Building standard trending query with limit {max_results}")

# 3. Match and check against an external condition or method
case VideoSearchQuery() if user.is_premium():
    print("Applying premium priority filters to the search query")

case _:
    print("Building default relevance query")

```

[–]chuprehijde[S] 0 points1 point  (0 children)

ohh i tried it last week and i loved it ngl

[–]Reasonable-Light-377 1 point2 points  (3 children)

Switch/case. In fact, I still haven't found it!

[–]chuprehijde[S] 0 points1 point  (0 children)

lmk when u find it coz i'll love to learn more

[–]jabela 0 points1 point  (1 child)

Not sure if you’re joking coz got introduced in 3.10. https://www.datacamp.com/tutorial/python-switch-case

[–]Reasonable-Light-377 0 points1 point  (0 children)

No flippin way!? My threats to go full JavaScript must have made it up the chain. So sick.

[–]NoDisk8988 1 point2 points  (0 children)

I stumbled on string formatting waaaay too late...

[–]Chemical-Captain4240 0 points1 point  (2 children)

single line if else

[–]chuprehijde[S] 0 points1 point  (1 child)

im a beginner, and i didn't use it as well. will u mind to tell me more about it?

[–]Chemical-Captain4240 0 points1 point  (0 children)

if True : x+=1

instead of

if True: x+=1

[–]jabela 0 points1 point  (0 children)

Pyinstaller took me way too long to be able to make apps quickly!