libpaths = [] if libpaths is None else libpaths.split(":") libpaths = [] if libpaths is None else libpaths.split(":")Of course in Python [] is False and in Ruby it's true...
[1]: https://docs.microsoft.com/en-us/dotnet/csharp/language-refe...
[2]: https://docs.microsoft.com/en-us/dotnet/csharp/language-refe...
Why not go the whole hog then, and do a Option[1] ;-)
And sadly, removing None from Python and replacing it by Option - let alone removing Exception and letting Result (aka Either) take its rightful place - would cause huge amount of Python code to need rewriting. And it wouldn't even be worth it because of dynamic typing.
As well as type checking (which is relevant because Python has AOT checkers even if they are optional), Options, compared to bills, give you nestability, which is a runtime advantage not dependent on static type checking.
No, it's nothing like the Ruby convention. It's much more like th C# operators.
x = x or []
or is it considered non idiomatic in python ?Using `x = [] if x is None else x` is more precise.