|
Progressive JPEG posted:does python still have that thing where input written by a foreigner suddenly triggers a requirement to blindly add .decode("utf8") to everything until the errors go away? the whole point of python 3 was to fix this. the main controversy over python 3 was that it forced everyone to fix it, even people who had not yet encountered any input written by foreigners and did not believe they ever would.
|
# ? Jul 12, 2019 08:35 |
|
|
# ? Jun 6, 2024 04:22 |
Progressive JPEG posted:does python still have that thing where input written by a foreigner suddenly triggers a requirement to blindly add .decode("utf8") to everything until the errors go away? that’s a python 2 relic
|
|
# ? Jul 12, 2019 08:50 |
|
Nomnom Cookie posted:you can also multiply lists by numbers lol yeah the first time i saw [0]*40 for initializing a 40 element list with 0 in each position i was like wtf
|
# ? Jul 12, 2019 09:19 |
|
Krankenstyle posted:lol yeah the first time i saw [0]*40 for initializing a 40 element list with 0 in each position i was like wtf it’s always fun the first time someone learns about this and then immediately does [[]]*10 to initialise a list of lists
|
# ? Jul 12, 2019 09:26 |
|
Yeah, that syntax does not work well with mutable types...
|
# ? Jul 12, 2019 10:31 |
|
Share Bear posted:OK so what is the preferred way to transform another class or dict or other list into a new list? I thought this was pretty snappy. List comprehensions are good. Comments like these are not: Python code:
|
# ? Jul 12, 2019 10:40 |
|
wait f-strings own bones (when you stick to vars and don't get weird with arbitrary code)
|
# ? Jul 12, 2019 10:53 |
|
Krankenstyle posted:wait f-strings own bones (when you stick to vars and don't get weird with arbitrary code) handing guns to programmers and telling them not to point them at their feet has not, historically, tended to end well
|
# ? Jul 12, 2019 10:58 |
|
Soricidus posted:handing guns to programmers and telling them not to point them at their feet has not, historically, tended to end well fair
|
# ? Jul 12, 2019 11:04 |
|
Soricidus posted:handing guns to programmers and telling them not to point them at their feet has not, historically, tended to end well pretending that things that are troublesome don't need to be done has tended to yield a mix of terrible code and irrelevance though (will see whether go doesn't manage both within a decade). removing string formatting facilities entirely would of course prevent abuse, but every program doing string formatting would then be a horrific bug-ridden mess. not sure that f-strings is the best idea ever, but unless we're going to constrain ourselves out of Turing-completeness the programmers have plenty of guns already.
|
# ? Jul 12, 2019 11:12 |
|
Progressive JPEG posted:python in production? oof Mate one of the products I worked on shipped its own copy of the Python interpreter as part of its runtime, even
|
# ? Jul 12, 2019 11:17 |
|
Progressive JPEG posted:python in production? oof its more common than you think I would guess it's because it's an easy sell to management: "see? quick and easy to make programs"
|
# ? Jul 12, 2019 11:22 |
|
feedmegin posted:Mate one of the products I worked on shipped its own copy of the Python interpreter as part of its runtime, even well, obviously. you'd be stupid to set yourself up for someone just running the thing on whatever, at least if they have your contact details.
|
# ? Jul 12, 2019 11:27 |
|
Boiled Water posted:its more common than you think "So, here is our first-pass, narrow vertical slice, skunkworks proof-of-concept prototy-" "Ship it! Ship it real good!"
|
# ? Jul 12, 2019 12:11 |
|
ynohtna posted:"So, here is our first-pass, narrow vertical slice, skunkworks proof-of-concept prototy-" I see we work in the same place. "Proof of concept proofs concept? SHIP! IT!"
|
# ? Jul 12, 2019 12:22 |
Boiled Water posted:I see we work in the same place. “ah you made an r shiny app with some graphs?” “yeah it’s a rough mock of some of our key analytics for quant dev team to have easier time until bi team is fully formed” “great, c-suite will love to use it”
|
|
# ? Jul 12, 2019 14:01 |
|
implement feature for exactly one customer, with no thought as to how usage may differ for other customers immediately release the feature to all customers with no documentation beyond a list of config settings with minimal explanations
|
# ? Jul 12, 2019 14:33 |
florida lan posted:implement feature for exactly one customer, with no thought as to how usage may differ for other customers yeah i had to maintain that pile of poo poo for 7 months. “architecturally” it was a daily cron’d bash script that would execute a python script which executes pile of SQL scripts, running against a dozen undocumented databases with bi-weekly uncommunicated structure changes, into csv files. then it stops shiny app, moves old csvs into archive, new csvs into data dir, and restarts shiny
|
|
# ? Jul 12, 2019 14:42 |
|
Soricidus posted:handing guns to programmers and telling them not to point them at their feet has not, historically, tended to end well agreed, which is why we should all program in go
|
# ? Jul 12, 2019 14:49 |
|
florida lan posted:implement feature for exactly one customer, with no thought as to how usage may differ for other customers that's agile!
|
# ? Jul 12, 2019 15:10 |
|
Sapozhnik posted:agreed, which is why we should all program in go making people use go is like preventative foot amputation on the basis that you can’t shoot what you don’t have
|
# ? Jul 12, 2019 15:50 |
|
Progressive JPEG posted:does python still have that thing where input written by a foreigner suddenly triggers a requirement to blindly add .decode("utf8") to everything until the errors go away? cinci zoo sniper posted:that’s a python 2 relic also a relic found in loads of lovely software that for some arcane reason needs to be both python 2.7 and python 3 compatible. Like say most of the AWS library
|
# ? Jul 12, 2019 16:03 |
|
type safety guarantees once it’s compiled everyone will be forced to use my improperly optimized, logically incorrect code forever
|
# ? Jul 12, 2019 16:29 |
|
Soricidus posted:the whole point of python 3 was to fix this. the main controversy over python 3 was that it forced everyone to fix it, even people who had not yet encountered any input written by foreigners and did not believe they ever would. i know of at least one person who got super butthurt about python 3 using str for filenames. passing arbitrary garbage to open() was apparently mission-critical. as linux allows anything but \0 in a filename and they were making full use of that capability. i went and checked--for my entire career i've been passing string filenames to the JVM, I have no idea what encoding the JVM uses when making the system call, and it's been an issue exactly 0 times give a programmer tools to build things with and instead they'll dig a giant pit full of garbage. try to fill in the pit, maybe turn it into a nice park or something, and they'll bitch at you for breaking their poo poo
|
# ? Jul 12, 2019 18:34 |
|
Progressive JPEG posted:does python still have that thing where input written by a foreigner suddenly triggers a requirement to blindly add .decode("utf8") to everything until the errors go away?
|
# ? Jul 12, 2019 19:00 |
Nomnom Cookie posted:i know of at least one person who got super butthurt about python 3 using str for filenames. passing arbitrary garbage to open() was apparently mission-critical. as linux allows anything but \0 in a filename and they were making full use of that capability. i went and checked--for my entire career i've been passing string filenames to the JVM, I have no idea what encoding the JVM uses when making the system call, and it's been an issue exactly 0 times Nowadays open() takes anything implementing os.PathLike so this person is in luck!
|
|
# ? Jul 12, 2019 19:08 |
|
Nomnom Cookie posted:i went and checked--for my entire career i've been passing string filenames to the JVM, I have no idea what encoding the JVM uses when making the system call, and it's been an issue exactly 0 times It's because it's an abstraction, and depending on the JVM implementation and platform, it's different on linux it defers to java.io.UnixFileSystem, i'm sure there's one for windows as well EDIT: here's the windows NT impl https://github.com/stain/jdk8u/blob/master/src/windows/classes/java/io/WinNTFileSystem.java CRIP EATIN BREAD fucked around with this message at 19:14 on Jul 12, 2019 |
# ? Jul 12, 2019 19:11 |
|
The sensible thing for Unix is to use a UTF-8 string that preserves invalid code point sequences and just presents them as that replacement character if you interrogate it as a string. But that doesn’t really work on Windows because IIRC native paths use 16-bit code points, and it also doesn’t really work in languages that expose the use of UTF-16.
rjmccall fucked around with this message at 19:19 on Jul 12, 2019 |
# ? Jul 12, 2019 19:17 |
|
CRIP EATIN BREAD posted:It's because it's an abstraction, and depending on the JVM implementation and platform, it's different sure it's platform-specific. what i meant is that it has never once mattered how the UTF-16 turns into bytes for the kernel, nor have I have needed to answer the question "what if I want to open a file with a name that has no unicode representation". I don't think the stdlib supports that, or ever has. it's never been anyone's criticism of java that it doesn't support opening garbage filenames. and yet for some people that's a big issue with python 3.
|
# ? Jul 12, 2019 19:28 |
|
Nomnom Cookie posted:sure it's platform-specific. what i meant is that it has never once mattered how the UTF-16 turns into bytes for the kernel, nor have I have needed to answer the question "what if I want to open a file with a name that has no unicode representation". I don't think the stdlib supports that, or ever has. it's never been anyone's criticism of java that it doesn't support opening garbage filenames. and yet for some people that's a big issue with python 3. well python is for idiots
|
# ? Jul 12, 2019 19:35 |
|
list comprehensions are bad because they read in a completely random order. linq is much better than this because linq reads very clearly from left to right.
|
# ? Jul 12, 2019 19:47 |
|
rjmccall posted:The sensible thing for Unix is to use a UTF-8 string that preserves invalid code point sequences and just presents them as that replacement character if you interrogate it as a string. But that doesn’t really work on Windows because IIRC native paths use 16-bit code points, and it also doesn’t really work in languages that expose the use of UTF-16. are you counting macos as a unix? if so, what about unicode decomposition?
|
# ? Jul 12, 2019 20:17 |
|
Nomnom Cookie posted:sure it's platform-specific. what i meant is that it has never once mattered how the UTF-16 turns into bytes for the kernel, nor have I have needed to answer the question "what if I want to open a file with a name that has no unicode representation". I don't think the stdlib supports that, or ever has. it's never been anyone's criticism of java that it doesn't support opening garbage filenames. and yet for some people that's a big issue with python 3. What if you're opening files on, for example, a commercial Unix with a legacy encoding like EUCJP for Japanese? 'If it's not Unicode it's garbage' is not a practical approach in the real world.
|
# ? Jul 12, 2019 20:37 |
|
feedmegin posted:What if you're opening files on, for example, a commercial Unix with a legacy encoding like EUCJP for Japanese? 'If it's not Unicode it's garbage' is not a practical approach in the real world. Sure, but outputting to a well-known encoding scheme isn't that big a deal, and in the java example would be easily handled by just setting the default character encoding for the environment to EUCJP (if it wasn't already).
|
# ? Jul 12, 2019 20:59 |
|
Fiedler posted:are you counting macos as a unix? if so, what about unicode decomposition? the filesystem is almost certainly going to use different unicode normalization than user-level libraries want to. among other things, the filesystem has forward/backward compatibility restrictions that might put it in an impossible position: it probably doesn’t want to ban characters that weren’t in unicode when it was compiled, but new characters can come with arbitrary new normalization rules. and in fact, different filesystems are not unlikely to use different unicode normalizations from each other. so you can have things like strings that compare equal in the language but name different files on one filesystem but not another. the most sensible way for intermediate levels to handle this — whether the programming language or the kernel — is to propagate string data through unmolested as much as possible, and then at least basic functionality (opening files, reading directories) will generally work, which means it’s at least possible to work around these problems in user code. the only issue is if you’re doing things like renormalizing filenames or sticking them in hashtables
|
# ? Jul 12, 2019 21:00 |
|
*chris Farley voice* you can take a poo poo in a rust box and all you’ve got is a type safe piece of poo poo
|
# ? Jul 12, 2019 22:40 |
|
fabrice bellard's new dependency-free embeddable js interpreter kinda owns wonder how long it'll be before somebody uses it to build a javascript bootloader and begin the js apocalypse, as the legends foretold
|
# ? Jul 13, 2019 00:25 |
|
i normally work almost exclusively in kotlin, but have stood up half a dozen or so bottle+gunicorn APIs that front some keras/tensorflow poo poo. that kind of python in production is extremely non-problematic, but i can imagine some monolithic django app could be a huge pain to deal with edit: i also have co-workers who have to be forced to use "that newfangled" python 3. the thing that's been available for 11+ years. so gently caress python. luchadornado fucked around with this message at 01:44 on Jul 13, 2019 |
# ? Jul 13, 2019 01:42 |
|
Internet Janitor posted:fabrice bellard's new dependency-free embeddable js interpreter kinda owns in 20 years there will only be js
|
# ? Jul 13, 2019 02:03 |
|
|
# ? Jun 6, 2024 04:22 |
|
Honestly, having read both codebases, I like Duktape better
|
# ? Jul 13, 2019 02:07 |