Scott Williams 🐧 ( vwbusguy@mastodon.online ) to Programming@fedia.io · 2 years agoPython pop quizmessage-squaremessage-square15linkfedilinkarrow-up11file-text
arrow-up11message-squarePython pop quizScott Williams 🐧 ( vwbusguy@mastodon.online ) to Programming@fedia.io · 2 years agomessage-square15linkfedilinkfile-text
minus-squareScott Williams 🐧 ( vwbusguy@mastodon.online ) OPlinkfedilinkarrow-up1·2 years agoHypothesis: My German friends/followers will be more likely to know the answer than my fellow Americans.
minus-squareFabio Valentini ( decathorpe@mastodon.social ) linkfedilinkarrow-up1·2 years ago@vwbusguy@mastodon.online what does this have to do with German (I say as a native German speaker)?
minus-squareScott Williams 🐧 ( vwbusguy@mastodon.online ) OPlinkfedilinkarrow-up1·2 years ago@decathorpe Because “1.200,30” is how a German would write the American equivalent of “1,200.30”, so a German might be more likely to have tried this before and therefore might have a better chance at the result.
minus-squareMichael T Babcock ( mikebabcock@floss.social ) linkfedilinkarrow-up1·2 years ago@vwbusguy@mastodon.online @decathorpe@mastodon.social almost all of Europe uses the comma that way, don’t they? I know France does. I do love Python for allowing underscores as thousands separators.
minus-squareScott Williams 🐧 ( vwbusguy@mastodon.online ) OPlinkfedilinkarrow-up1·2 years ago@mikebabcock@floss.social @decathorpe@mastodon.social IIRC, that behavior is because python is a wrapper on C.
minus-squareMichael T Babcock ( mikebabcock@floss.social ) linkfedilinkarrow-up1·2 years ago@vwbusguy@mastodon.online @decathorpe@mastodon.social
minus-squareFabio Valentini ( decathorpe@mastodon.social ) linkfedilinkarrow-up1·2 years ago@vwbusguy@mastodon.online but … the thousands separator in Python is the underscore? also, the dot and comma switcheroo is not a German-or-not-German thing, but an anglocentric-or-not-anglocentric thing 😁: https://en.m.wikipedia.org/wiki/Decimal_separator#Hindu%E2%80%93Arabic_numerals
minus-squareScott Williams 🐧 ( vwbusguy@mastodon.online ) OPlinkfedilinkarrow-up1·edit-22 years ago@decathorpe You’re proving that a German understands the answer 😅. Most Americans don’t know about this differentiation. It seems there is a new proposal to make _ the thousands separator: https://peps.python.org/pep-0378/
minus-squareFabio Valentini ( decathorpe@mastodon.social ) linkfedilinkarrow-up1·2 years ago@vwbusguy@mastodon.online this PEP seems to be about printing, but you can already use _ in numeric literals like this: one_million = 1_000_000
minus-squareScott Williams 🐧 ( vwbusguy@mastodon.online ) OPlinkfedilinkarrow-up1·2 years ago@decathorpe Fair enough, but python supported comma as the delimited for input, too. “The new-style number-to-string formatting language will be extended to allow _ as a thousands separator, where currently only , is supported.” https://peps.python.org/pep-0515/
minus-squareFabio Valentini ( decathorpe@mastodon.social ) linkfedilinkarrow-up1·2 years ago@vwbusguy@mastodon.online oh that’s very cursed
minus-squareScott Williams 🐧 ( vwbusguy@mastodon.online ) OPlinkfedilinkarrow-up1·2 years ago@decathorpe@mastodon.social Your browser does not support playing HTML5 video. You can download a copy of the video file instead. Here is a description of the content: Image from Microsoft SwiftKey Keyboard
minus-squareScott Williams 🐧 ( vwbusguy@mastodon.online ) OPlinkfedilinkarrow-up1·2 years agoIt is a tuple. Python supports multiple assignments and this can be achieved by comma separation. For example: x, y = 1.200,30 x would be 1.2 y would be 30
Hypothesis: My German friends/followers will be more likely to know the answer than my fellow Americans.
@vwbusguy@mastodon.online what does this have to do with German (I say as a native German speaker)?
@decathorpe Because “1.200,30” is how a German would write the American equivalent of “1,200.30”, so a German might be more likely to have tried this before and therefore might have a better chance at the result.
@vwbusguy@mastodon.online @decathorpe@mastodon.social almost all of Europe uses the comma that way, don’t they? I know France does. I do love Python for allowing underscores as thousands separators.
@mikebabcock@floss.social @decathorpe@mastodon.social IIRC, that behavior is because python is a wrapper on C.
@vwbusguy@mastodon.online @decathorpe@mastodon.social
@vwbusguy@mastodon.online but … the thousands separator in Python is the underscore?
also, the dot and comma switcheroo is not a German-or-not-German thing, but an anglocentric-or-not-anglocentric thing 😁:
https://en.m.wikipedia.org/wiki/Decimal_separator#Hindu%E2%80%93Arabic_numerals
@decathorpe You’re proving that a German understands the answer 😅. Most Americans don’t know about this differentiation.
It seems there is a new proposal to make _ the thousands separator:
https://peps.python.org/pep-0378/
@vwbusguy@mastodon.online this PEP seems to be about printing, but you can already use _ in numeric literals like this:
one_million = 1_000_000
@decathorpe Fair enough, but python supported comma as the delimited for input, too.
“The new-style number-to-string formatting language will be extended to allow _ as a thousands separator, where currently only , is supported.”
https://peps.python.org/pep-0515/
@vwbusguy@mastodon.online oh that’s very cursed
@decathorpe@mastodon.social
It is a tuple. Python supports multiple assignments and this can be achieved by comma separation. For example:
x, y = 1.200,30
x would be 1.2
y would be 30