Be Careful with Python's New-Style String Format
lucumr.pocoo.org
Be Careful with Python's New-Style String Format
1–10 of 155 posts
Re: Be Careful with Python's New-Style String Format
#2Re: Be Careful with Python's New-Style String Format
#3Re: Be Careful with Python's New-Style String Format
#4Might as well write "be careful about eval of arbitrary user provided strings".
Re: Be Careful with Python's New-Style String Format
#5Re: Be Careful with Python's New-Style String Format
#6I do love writing python, but it's pretty shocking when I find out you can write something like `event.__init__.__globals__[CONFIG][SECRET_KEY]`. That language just does not care about privacy or information hiding at all, I guess.
Re: Be Careful with Python's New-Style String Format
#7Err, why would you allow for the user to enter arbitrary format strings in the first place? Might as well write "be careful about eval of arbitrary user provided strings".
Re: Be Careful with Python's New-Style String Format
#8I do love writing python, but it's pretty shocking when I find out you can write something like `event.__init__.__globals__[CONFIG][SECRET_KEY]`. That language just does not care about privacy or information hiding at all, I guess.
This is a great power, but also can become an unlimited source of bugs.
Re: Be Careful with Python's New-Style String Format
#9 format!("{argument}", argument = "test"); // => "test"
That's just named arguments to the format. Also, that's a macro; it's expanded at compile time.Python's approach is lame. It should have used something with a limited list of named arguments, or maybe a dict.
Re: Be Careful with Python's New-Style String Format
#10... Uncontrolled format string bugs? In 2016? Really? Someone would fall for that? ..