Комментарии:
Great video Anthony. This is the most unintuitive thing in python for me. Any reason why it behaves this way?
ОтветитьNice! I was surprised that you hadn't covered this already, but definitely a good tip to know.
Regarding the check for the None value of x, I've gotten into the habit of writing "x = x or []" (I guess I'm lazy and only want to type one line!). I'd be interested to know if you thought this was good or bad practice?
Hi! Love your videos. But I usually watch them on my phone, so everything is a bit small. Maybe you can enlarge the font? Thanks :-)
ОтветитьInstead of writing
If x is None
x=x or (default) will do the trick
Because boolean operators don't return bools
This was great. I knew to avoid mutable defaults but genuinely didn't know that `__defaults__` existed. Thanks!
Ответить