|
also if they're extremely good w/ sql they prolly actually know trivalent logic so you should disabuse them of that knowledge being correct in any other programming context
|
# ? Nov 12, 2017 15:25 |
|
|
# ? Jun 1, 2024 21:41 |
bob dobbs is dead posted:actual python standard is to ask forgiveness not permission i usually do type annotations in my own stuff, but since they are suggestive even if i will do Union(Dict, None) (to type it out quickly), the problem is the inputs, rather than the outputs. i guess i should have mentioned it before, that this specific problem is to assert if the correct output type has been achieved from processing variable input. for static checking in itself pycharm is fairly good with type annotations indeed (although i usually get lost in object hell when i end up with numpy arrays and matplotlib graphs every loving where) try catch doesn't sound too great but i guess i could do, in second example Python code:
|
|
# ? Nov 12, 2017 15:27 |
|
cinci zoo sniper posted:i usually do type annotations in my own stuff, but since they are suggestive even if i will do Union(Dict, None) (to type it out quickly), the problem is the inputs, rather than the outputs. i guess i should have mentioned it before, that this specific problem is to assert if the correct output type has been achieved from processing variable input. for static checking in itself pycharm is fairly good with type annotations indeed (although i usually get lost in object hell when i end up with numpy arrays and matplotlib graphs every loving where) perf is loving miserable in try/catch if you're 1000% concerned about perf don't use python lol or use cython in the perf bits or use numpy or tf or pytorch for numerical poo poo
|
# ? Nov 12, 2017 15:30 |
c tp s: set up a local ubuntu vagrant box for dev, now to figure out the raw disk access mode on virtualbox, or other (preferably, less room to gently caress up) means to plug an ext4 drive into this poo poo
|
|
# ? Nov 12, 2017 15:30 |
|
cinci zoo sniper posted:c tp s: set up a local ubuntu vagrant box for dev, now to figure out the raw disk access mode on virtualbox, or other (preferably, less room to gently caress up) means to plug an ext4 drive into this poo poo the real c tp s is using vagrant in 2017 (lol jk it's cool and good and better than docker until about mid-2016 lol)
|
# ? Nov 12, 2017 15:32 |
bob dobbs is dead posted:perf is loving miserable in try/catch im not that concerned about perf. i just know that right now if/elif/else chains, even if i make poor mans case/switch statement with 15 elifs (parsing pretty printed salary range strings ), are fast enough for my stuff. in other words, it doesn't sound like i'm winning any points there with try/catch, so i might not need to bother. might just test this back in office
|
|
# ? Nov 12, 2017 15:34 |
|
cinci zoo sniper posted:im not that concerned about perf. i just know that right now if/elif/else chains, even if i make poor mans case/switch statement with 15 elifs (parsing pretty printed salary range strings ), are fast enough for my stuff. in other words, it doesn't sound like i'm winning any points there with try/catch, so i might not need to bother. might just test this back in office the win is by having lots shorter and more understandable code. sometimes there is not a win. i would be pretty surprised if there was a perf gain from try catch blocks
|
# ? Nov 12, 2017 15:39 |
bob dobbs is dead posted:the real c tp s is using vagrant in 2017 im not sure how the docker vs vagrant goes down, but pycharm has neat vagrant integration. you can surely use docker with it too, but we're talking product-specific integration vs generic remote thing, afaik. besides, vagrant runs on top of virtualbox which might be what i actually need (im not running a vm locally just because i can poorly do so), and it might actually be running better than docker would since tangential googling suggests that i have an actual vagrant use case, just setting my development environment right. im not deploying anything anywhere, this is for local high-level "io"/analysis tool to try to avoid having linux on dualboot due to data sitting on an external ext4 drive
|
|
# ? Nov 12, 2017 15:39 |
bob dobbs is dead posted:the win is by having lots shorter and more understandable code. sometimes there is not a win. im not even seeing that strong code readability with the in locals() or better the assert versions. compared to what ive coached my guy into, sure. that 15 elif example? impossible, the only alternative to bruteforcing "less than 20,000 EUR" "20,000 to 50,000 EUR" "50,000 to 100,000 EUR" "more than 100,000 EUR" would've been a regex trick that would've taken more than the minute i spent on this bob dobbs is dead posted:why this is less idiotic than one may imagine at first glance: bob dobbs is dead posted:also if they're extremely good w/ sql they prolly actually know trivalent logic so you should disabuse them of that knowledge being correct in any other programming context
|
|
# ? Nov 12, 2017 15:49 |
|
tp q: is your development setup really so complicated and unwieldy that you need to learn yet another loving special snowflake configuration file format (vagrantfiles) instead of just saving the same install commands you originally used into a script and chucking that script into vc, and running it on a fresh blank vm when you need a new box? and in a lot of cases, is your development setup so complicated *and* so often changing that you need to version control it at all instead of just downloading the .ova and maybe cloning it when you want to try an updated ide or whatever?
|
# ? Nov 12, 2017 15:49 |
NihilCredo posted:tp q: is your development setup really so complicated and unwieldy that you need to learn yet another loving special snowflake configuration file format (vagrantfiles) instead of just saving the same install commands you originally used into a script and chucking that script into vc, and running it on a fresh blank vm when you need a new box? no, i want read access on ext4 drive from windows 10. that can allegedly be done with oracle virtualbox, and vagrant is fastest/laziest way to plug oracle virtualbox into pycharm. my interaction with vagrantfile has been limited to uncommenting a single line to enable private network interface, so i can set up project folder synchronisation between local environment and the vm via sftp (again, the laziest way, 1 click in pycharm)
|
|
# ? Nov 12, 2017 15:51 |
|
cinci zoo sniper posted:im not holding my breath, 0-indexing is already proving to be a shocking discovery. not sure if he is good enough to make use of trivalent logic, but im not man enough to delve into thousands of lines long uncommented sql scripts this statement is incompatible with the person you're teaching actually being good at sql
|
# ? Nov 12, 2017 15:53 |
bob dobbs is dead posted:this statement is incompatible with the person you're teaching actually being good at sql
|
|
# ? Nov 12, 2017 15:56 |
and i mean, as always, i get to be the lucky loving exception, e.g. the designated database architect because this place has no one responsible/motivated enough, and probably no one competent enough either. thankfully, we have hired the etl developer i mentioned the post earlier so he will be taking this over from me before it gets from "here's table layout we want, and some indices" to the stage where my decisions start to actually gently caress things up
|
|
# ? Nov 12, 2017 15:57 |
|
cinci zoo sniper posted:no, i want read access on ext4 drive from windows 10. that can allegedly be done with oracle virtualbox, and vagrant is fastest/laziest way to plug oracle virtualbox into pycharm. my interaction with vagrantfile has been limited to uncommenting a single line to enable private network interface, so i can set up project folder synchronisation between local environment and the vm via sftp (again, the laziest way, 1 click in pycharm) Using dokan on windows: there doesn't seem to be a ext4 driver Using a user mode program on WSL: no way to get raw access to a block device Using a user mode program on Windows: there used to be a program called Ltools but it doesn't seem to have been updated in years (the last version only had ext3 support!)
|
# ? Nov 12, 2017 16:06 |
mystes posted:It's surprising that there doesn't seem to be a good way to do this in 2017. I thought of a couple ways that you would think would work but don't seem to actually be possible: ive seen a few more, like paragon ext4 tools etc, but basically it all seems shite. paragon worked i guess, but they provide their own interface to data, rather than mount it on system, which is pita since if i had this much space locally id long since copied it all over through a linux boot stick or something
|
|
# ? Nov 12, 2017 16:13 |
c tp mission report s: we are in, huston. that's one small step for the thread, one giant leap for a terrible programmer
|
|
# ? Nov 12, 2017 16:19 |
turned out it indeed was the matter of just going to vagrantbox settings in virtualbox and enabling usb 3.0 host controller. after that, my drive showed up as "seagate something" in there, and it worked like a charm. sudo mount /dev/sda1 /media, baby
|
|
# ? Nov 12, 2017 16:21 |
now the minor problem is that ive hamstrung myself out a fifth to a quarter of my ram this way, give or take, but, thankfully, ive written this project so it could run on a toaster if need be
|
|
# ? Nov 12, 2017 16:26 |
|
ctps on my liberal arts degree having rear end rando from the 80s published way to reduce hidden markov model to linear neural net by loving around with the params. basically when you need a probabilistic (kolmogorov probabilistic) transition matrix, you normalize w/ softmax fun times: this is not actually a linear op. softmax is not a linear op fun times 2: this is not actually, then, a linear neural net fun times 3: lol mnist isn't doing the standard linear 92% on hmm w/ ergodic ansatz fun times 4: I NEED YOU TO BE LINEAR RIGHT NOW OKAY
|
# ? Nov 12, 2017 16:44 |
|
OldAlias posted:fake possibly gay as well
|
# ? Nov 12, 2017 17:01 |
bob dobbs is dead posted:ctps on my liberal arts degree having rear end are you doing some kind of nlp?
|
|
# ? Nov 12, 2017 17:02 |
|
terrible programmer update: god it is the loving worst when a library has only 3 sources of documentation: 1) a single hello-world spinning square blog post 2) a single application that uses it, that you have to hope uses the feature you need 3) library source, which is a huge mess of interconnecting libraries and type synonyms
|
# ? Nov 12, 2017 17:12 |
|
cinci zoo sniper posted:are you doing some kind of nlp? mnist is pictures of numbers. but it's also from the 90's so it's gotten the poo poo kicked out of it no, i'm doing basic research for fun
|
# ? Nov 12, 2017 17:16 |
bob dobbs is dead posted:mnist is pictures of numbers. but it's also from the 90's so it's gotten the poo poo kicked out of it ah, i see
|
|
# ? Nov 12, 2017 17:20 |
|
To rant a little more: like seriously why is is SO much more complicated to render the text in the window than it is to choose the title bar text? Like I had to specify a glyph cache, an asset loading factory, a font asset file etc. Also it turns out that you can just pass the unit type as the factory but nowhere is that specified in the list of implementations or in the docs. If the author hadn't written a soduku program that I could copy paste from, I would not have been able to do it.
|
# ? Nov 12, 2017 17:28 |
|
Title bar text is a trivial API call, font rendering is a gigantic DIY sequence. Ask me about rendering fonts in JS manually onto a Canvas, using batched 2D calls obviously, to get onto WebGL because I want to use a specific OpenType feature and the typeface license says I cannot just bypass that crap and modify the font file to get it. The amount of tedium to then bring in relatively basic things like bold and italic text is horrendous.
|
# ? Nov 12, 2017 18:53 |
|
I mean I kind of aim to give this thing multiple front ends, one of which is capable of being rendered in a browser but gently caress text rendering, it may just put me off.
|
# ? Nov 12, 2017 19:01 |
|
cinci zoo sniper posted:whats a good pattern to teach somewhat new programmer (some r scripting experience, extremely good with sql) for multi-case error handling in python probably not what you're talking about but I like early returns: Python code:
|
# ? Nov 12, 2017 23:26 |
Symbolic Butt posted:probably not what you're talking about but I like early returns: why, this would do the same primarily. i dont particularly like the coding style, but it'd work. trickier if i want to make a blanked assertion about the foo/[0], but that's a further part of the song by the way, i wonder, whats the performance difference on if if vs if elif in this specific scenario
|
|
# ? Nov 12, 2017 23:41 |
|
early returns seems like the best way imo. better for abstraction. also more idiomatic i would also never use locals(), you're diving into the python internals which just feels hacky re: try/catch perf, as said before if you care about perf you're not using python, if you do care about perf you'd be measuring it, and your slowest code almost certainly isn't exception handling Mr SuperAwesome fucked around with this message at 10:10 on Nov 13, 2017 |
# ? Nov 13, 2017 10:07 |
|
there's no perf difference here because the if doesn't fall through. if it didn't then yeah, you would get a slight win from "else if", but more importantly someone reading your code would understand immediately that you expect the cases to be independent
|
# ? Nov 13, 2017 10:23 |
Mr SuperAwesome posted:early returns seems like the best way imo. better for abstraction nothing wrong with locals(), an object will not exist in a function instance if i don't create it. sure, i might be flying close to the sun, but it works getting really tired of this thread meme "le mao xddddddd why u goof are using werd "perf" in poopon". just because it isnt fastest thing on the planet does not invalidate my desire not to slow done code a 100 times or whatever because of some ~pythonic~ way for exception handling that yields identical result. and yes, i fully expect exception handling to be one of the slowest parts by far, since everything else is bare pandas/numpy. it is blazing fast as is, and i would rapidly run out of things to optimise before my natural next step would become cython or numba or something.
|
|
# ? Nov 13, 2017 10:39 |
rjmccall posted:there's no perf difference here because the if doesn't fall through. if it didn't then yeah, you would get a slight win from "else if", but more importantly someone reading your code would understand immediately that you expect the cases to be independent
|
|
# ? Nov 13, 2017 10:41 |
|
cinci zoo sniper posted:i dont, which is why i wondered why symbolic butt put two ifs. its the same data, it can just be a list or a dict because our developers are bad coworkers and programmers alike in this case it compiles to the same bytecode, you can check it with dis. I used 2 ifs instead of if-elif out of habit. I like to start functions with a bunch of "if condition: return" statements, functional programmers like to call these guards. they usually simplify a lot of the code in my experience, you try to deal with the "special" cases right at the beginning instead of leaving it to the middle of the logic of the function. and oh I know it's kind of silly to think too much about this example but in a case like this I wouldn't write a function that works for both a list and a dictionary. I'd just write one function that works for list-likes and leave the responsibility of converting a dict to a list for the caller. and then maybe the caller should do the try-except if it's a relevant thing for their control flow (which is bad): Python code:
|
# ? Nov 13, 2017 11:51 |
Symbolic Butt posted:in this case it compiles to the same bytecode, you can check it with dis. Symbolic Butt posted:and oh I know it's kind of silly to think too much about this example but in a case like this I wouldn't write a function that works for both a list and a dictionary. I'd just write one function that works for list-likes and leave the responsibility of converting a dict to a list for the caller.
|
|
# ? Nov 13, 2017 11:59 |
|
cinci zoo sniper posted:just because it isnt fastest thing on the planet does not invalidate my desire not to slow done code a 100 times or whatever because of some ~pythonic~ way for exception handling that yields identical result. maintainability, readability and being idiomatic is often (IME, almost always) more important than pure performance this is also the point of python: https://www.python.org/dev/peps/pep-0020/
|
# ? Nov 13, 2017 12:00 |
Mr SuperAwesome posted:maintainability, readability and being idiomatic is often (IME, almost always) more important than pure performance Python code:
|
|
# ? Nov 13, 2017 12:03 |
basically just forget i asked
|
|
# ? Nov 13, 2017 12:10 |
|
|
# ? Jun 1, 2024 21:41 |
|
Python code:
you gotta float like a butterfly with returns man, don't let variables weigh on you (imo)
|
# ? Nov 13, 2017 12:22 |