|
nevermind it's bad
|
# ? Sep 7, 2016 02:00 |
|
|
# ? May 11, 2024 21:45 |
|
Skim Milk posted:IS PYTHON BAD? [Y/n] 2 or 3? yes and yes
|
# ? Sep 7, 2016 02:21 |
|
that list thing wasn't very surprising. i wouldn't present it as a reason for why the language is bad.
|
# ? Sep 7, 2016 02:22 |
|
although "multiplying" lists to generate larger ones it pretty gimmicky
|
# ? Sep 7, 2016 02:28 |
|
This behavior isn't at all surprising outside the context of python. Any language that has a way to pass a value to fill a list or array is going to have a problem with object references unless the array/list constructor deep copies the object by default. This is the biggest problem in Javascript, because the Array constructor specifically encourages you to make this mistake, but other languages that allow you to easily combine copies of references will have this problem to. In terms of other plangs, I just checked powershell actually has the exact same multiplication syntax with the same problem, although ironically its horrible automatic flattening of lists actually means you have to be really emphatic about keeping nested lists to have this problem. The main problem in the case of python is that this syntax is actually considered the idiomatic way to make copies of lists of values (e.g. strings) in python, which is dumb considering this pitfall. The smart languages simply don't provide any obvious way to pass a single object to initialize an array/list, which at least makes it more likely that people will at least accidentally instantiate multiple copies.
|
# ? Sep 7, 2016 02:42 |
|
Skim Milk posted:IS PYTHON BAD? [Y/n] very y
|
# ? Sep 7, 2016 02:43 |
|
mystes posted:This behavior isn't at all surprising outside the context of python. Any language that has a way to pass a value to fill a list or array is going to have a problem with object references unless the array/list constructor deep copies the object by default. This is the biggest problem in Javascript, because the Array constructor specifically encourages you to make this mistake, but other languages that allow you to easily combine copies of references will have this problem to. In terms of other plangs, I just checked powershell actually has the exact same multiplication syntax with the same problem, although ironically its horrible automatic flattening of lists actually means you have to be really emphatic about keeping nested lists to have this problem. doesnt the c++ vector have a constructor that does that? actually maybe i shouldn't be considering c++ among the "smart" languages
|
# ? Sep 7, 2016 02:50 |
|
gosh it's almost like mutability is a low-level micro-optimization that should be handled by the compiler, rather than the biggest hammer in your programming language's abstraction toolbox that you pound the gently caress out of all your control flow with
|
# ? Sep 7, 2016 03:12 |
|
full
|
# ? Sep 7, 2016 03:23 |
|
JewKiller 3000 posted:gosh it's almost like mutability is a low-level micro-optimization that should be handled by the compiler, rather than the biggest hammer in your programming language's abstraction toolbox that you pound the gently caress out of all your control flow with i'll mutate whatever the gently caress i want whenever i want you jackbooted fascist thug!
|
# ? Sep 7, 2016 03:29 |
|
YeOldeButchere posted:i'll mutate whatever the gently caress i want whenever i want you jackbooted fascist thug! const_cast for the people!
|
# ? Sep 7, 2016 03:31 |
|
no consts, no locks!
|
# ? Sep 7, 2016 03:46 |
|
oh no now my compiler hasn't emitted the proper memory barriers and there's brutal fighting in my cores' caches over what should be trivial details! who could have seen this coming!?
|
# ? Sep 7, 2016 03:49 |
|
Powerful Two-Hander posted:now I've unfucked my solution..... is there a web graphing library that isn't a total pain to use? c3 or d3? Reuters has been working with the d3 team and making new HTML polymer objects for everything and it is starting to look incredibly nice.
|
# ? Sep 7, 2016 04:05 |
|
YeOldeButchere posted:i'll mutate whatever the gently caress i want whenever i want YeOldeButchere posted:oh no now my compiler hasn't emitted the proper memory barriers have you ever considered the possibility of a causal relationship here (i can't tell if you're joking or not. such is the state of the programming field)
|
# ? Sep 7, 2016 04:23 |
|
JewKiller 3000 posted:have you ever considered the possibility of a causal relationship here pretty sure that was a joke also if mutable vs. immutable isn't an important distinction in Python, then why have both tuple and list
|
# ? Sep 7, 2016 04:33 |
|
Mr Dog posted:full communism and functional programming now
|
# ? Sep 7, 2016 04:38 |
|
apparently cc65's assembler can target the 65816 but not its C compiler annoying the guy who wrote crapple's official Apple IIGS development environment 30 years ago still sells a package of all their native compilers, macro assemblers, utilities, and reference manuals for 25 bucks
|
# ? Sep 7, 2016 05:02 |
|
JewKiller 3000 posted:have you ever considered the possibility of a causal relationship here ours is a universe where the thought "javascript on the server" doesn't seem to cause spontaneous combustion, so i can see how the confusion might arise
|
# ? Sep 7, 2016 05:07 |
|
wasn't that a thing in Netscape's application server way back in the mists of time
|
# ? Sep 7, 2016 05:30 |
HappyHippo posted:doesnt the c++ vector have a constructor that does that? I thought C++ used the object's copy constructor to insert it into the vector (unless it's a vector of references), and copy constructors are supposed to provide deep copy semantics. So it actually wouldn't have this problem, right?
|
|
# ? Sep 7, 2016 06:42 |
|
LordSaturn posted:in case you're serious: i was serious yes, ty for this. while i have taught beginner python i don't really use it or know it
|
# ? Sep 7, 2016 07:24 |
|
LordSaturn posted:pretty sure that was a joke tuples have a statically known length, encoded in the typ....oh wait never mind tuples are heterogeneous, i.e. different members can have different ty...poo poo never mind you're not a cool modern lang unless you have tuples
|
# ? Sep 7, 2016 07:27 |
Soricidus posted:wow both of you really overcomplicated your explanations by trying to introduce a non-existent distinction between immutable and mutable types. I never realized this. Thanks.
|
|
# ? Sep 7, 2016 07:33 |
|
hard to get excited about tuples unless your lang offers syntactic sugar around them
|
# ? Sep 7, 2016 07:42 |
|
like what language
|
# ? Sep 7, 2016 07:44 |
|
VikingofRock posted:I thought C++ used the object's copy constructor to insert it into the vector (unless it's a vector of references), and copy constructors are supposed to provide deep copy semantics. So it actually wouldn't have this problem, right? C++ always uses value semantics unless you tell it otherwise, so yes. Also it won't let you create a vector of references, period, so you would have to gently caress up with pointer, but at that point, you are willingly trying to, so . Soricidus posted:wow both of you really overcomplicated your explanations by trying to introduce a non-existent distinction between immutable and mutable types. code:
This is actually my favorite "WTF are you doing Python?" snippet.
|
# ? Sep 7, 2016 08:14 |
|
VikingofRock posted:I thought C++ used the object's copy constructor to insert it into the vector (unless it's a vector of references), and copy constructors are supposed to provide deep copy semantics. So it actually wouldn't have this problem, right? Luckily you cna't make a vector of references unless you wrap it in an std::ref or std::cref
|
# ? Sep 7, 2016 08:33 |
|
Xarn posted:C++ always uses value semantics unless you tell it otherwise, so yes. Also it won't let you create a vector of references, period, so you would have to gently caress up with pointer, but at that point, you are willingly trying to, so . += may or may not modify the lhs in place, so it also tries to do a regular assignment. in this case the modification does happen in place but the assignment fails, so you get the results you see. I'm not defending this but that's what's going on.
|
# ? Sep 7, 2016 09:31 |
|
MrMoo posted:c3 or d3?
|
# ? Sep 7, 2016 09:50 |
Xarn posted:C++ always uses value semantics unless you tell it otherwise, so yes. Also it won't let you create a vector of references, period, so you would have to gently caress up with pointer, but at that point, you are willingly trying to, so . Huh, I never knew that. I guess I just never tried to create a vector of references and always assumed you could. quote:
Okay WTF is going on here?
|
|
# ? Sep 7, 2016 09:59 |
|
my coworkers have difficulties with some concepts of lazy loading. unfortunately i need the size of the result set regardless of only loading n results per page. i asked one coworker to add a method to a rest interface to return the size of the data. he asked me why don't i just call the size method on the collection. we also discussed why it sucks that we need the size of the result set (because the query to determine the size might be just about as heavy as the query to just get the data). so another coworker suggests that we just don't execute queries that match too many rows and instead show "too many results" on the ui.
|
# ? Sep 7, 2016 10:05 |
VikingofRock posted:Okay WTF is going on here? code:
|
|
# ? Sep 7, 2016 11:39 |
|
Powerful Two-Hander posted:i have heard that there is a team at work that have written an xml import process in sql. unsurprisingly it fucks up all the time this can probably be blamed on microsoft for giving sql server some pretty freakin good xml support. i can see the thought process too: "well, it's going to go into the database already, and it's already xml..." for a feature that has no place in a loving database, sql server's xml facilities are astonishingly thorough and well-executed. however, i might be biased as i am intimately familiar with farting xml into and out of sql server and at least within sql server, dynamic sql is your only option if you want to do some pivoting with data on the fly (i.e. given a set of pivot columns that are only known at runtime). we use dynamic sql (generated and executed in one stored proc) for exactly that reason, although it is (1) delicate (2) easy to gently caress up (3) a pain in the rear end to debug (4) basically black magic for the 90% of devs who are only casual to semi-professional sql users. i'd be interested to know if any other dbs do better with dynamic pivots
|
# ? Sep 7, 2016 11:50 |
|
a few years ago, we had a guy working on a big, important, visible project. his code went though uat just fine etc etc. he deployed it to production, and immediately maxed out the cpu on the db, bringing the site down it turns out that every single stored procedure he'd written for that project used xml for input and output - exclusively. instead of passing an id in an integer parameter, he'd pass it in wrapped in an xml chunk and parse that out in the db, then return a blob of xml (which, of course, the application loaded into a string to pass around) so instead of SQL code:
SQL code:
|
# ? Sep 7, 2016 12:17 |
|
redleader posted:it turns out that every single stored procedure he'd written for that project used xml for input and output - exclusively. instead of passing an id in an integer parameter, he'd pass it in wrapped in an xml chunk and parse that out in the db, then return a blob of xml (which, of course, the application loaded into a string to pass around) his only mistake was using xml if he'd done the same thing in json, he could have called his code "cilantrodb.js" and passed it off as a brilliant new noSql storage engine
|
# ? Sep 7, 2016 12:49 |
|
NihilCredo posted:if he'd done the same thing in json, he could have called his code "cilantrodb.js" and passed it off as a brilliant new noSql storage engine this kills the shaggar
|
# ? Sep 7, 2016 15:16 |
|
loving hell this coworker preaches a rewrite of our gui to c++ because ~its crossplatform~ and ~faster~ than c# management bites because they don't know anything coworker encounters endless bugs interfacing with our hardware and keeps blaming me, the guy who wrote the firmware (and also the c# library for interfacing with the hardware that hes too good to use and also the c# gui that was abandoned), demands i debug it is just casually doing poo poo like using uninitialized array values, sending garbage data down the wire to our device no poo poo it doesnt work "this is a very high priority issue please fix" resolution, provided by me, person who does not know c++: for(auto i = 0; i < 20; i++) { butts[i] = 0; } i wanna run UBSan on this code base or something and print out the results and just leave it on management's desk yes, by the way, this is (in theory, some day) for a medical device.
|
# ? Sep 7, 2016 15:45 |
|
hobbesmaster posted:this kills the shaggar if only
|
# ? Sep 7, 2016 15:45 |
|
|
# ? May 11, 2024 21:45 |
|
of course, this is the same idiot coworker who doesn't think unit tests are a thing and insists that a dll is nothing (???)
|
# ? Sep 7, 2016 15:45 |