|
Ok thank you people trying to explain python to me. Frankly the whole "it's not really pass by reference OR pass by value" doesn't really make intuitive sense to me but I figure I'll get there eventually. For the time being, I'm mentally categorizing it as 'stuff is pass by reference in a function when the stuff is mutable' and 'its pass by value when it's not mutable' I know that is a simplification of 'python assigns names to values, which are really all objects' but it's the only way for me to think about it right now What is the benefit of doing typing/variable mapping like this, other than 'durr you don't got to put da variable type in da code'
|
# ? Jan 31, 2019 19:30 |
|
|
# ? Dec 6, 2024 01:37 |
|
Scionix posted:Ok thank you people trying to explain python to me. duck typing (whether static or dynamic) is much more flexible - one example that always gets brought up is erlang swapping out code modules at runtime because Butt1.0 has the same fields as Butt2.0 whereas a strict compiler would say "hey buddy you were expecting a Butt1.0 but they're passing some other poo poo I can't accept it"
|
# ? Jan 31, 2019 19:54 |
|
Scionix posted:I know that is a simplification of 'python assigns names to values, which are really all objects' but it's the only way for me to think about it right now in the case of python, the benefit was initially that everything was very simple to understand. it was all just dictionaries. an object is a dictionary: call a method = look up the method name in the object dictionary to find the method, and then invoke it with whatever parameters you have. set a variable = write the value to the current scope's dictionary using the name as the key. "foo.bar.baz()" just means "look up foo in the current scope dictionary, then look up bar in foo's dictionary, then look up baz in bar's dictionary, then try to call that as a function". sometimes if you don't find the thing in one dictionary then you look in another (e.g. go from an object's dictionary to it's class's dictionary to the parent class's dictionary; go from the local scope to the global scope). of course it's ended up being a bit more complicated than that with poo poo like __getattribute__ breaking the simple model, but at its heart it's still just lots of dictionaries "duck typing" is just the fancy name they bolted on after the fact to describe the behavior created by this simple implementation technique. nothing really knows or care about types, it just blindly reads things out of dictionaries and throws an exception if it can't find what it's looking for. it turns out this is exactly what you want for small-scale prototyping. allegedly some people manage to make it work well in large scale programs too, and all i can say is they must have a hell of a lot more discipline than i do because whenever i write something large in python it ends up being a horrible fragile mess and i have to throw it away and start over in a statically typed language so the compiler can hold my hand. but maybe that's just me belonging in this thread.
|
# ? Jan 31, 2019 22:36 |
|
Soricidus posted:allegedly some people manage to make it work well in large scale programs too, and all i can say is they must have a hell of a lot more discipline than i do because whenever i write something large in python it ends up being a horrible fragile mess and i have to throw it away and start over in a statically typed language so the compiler can hold my hand. but maybe that's just me belonging in this thread. I don't have the audacity to say that I "manage to make it work well" because well I'm a Terrible Programmer, but I seriously don't get much out of the compiler when I do C++ compared to python. In some sense I feel like sometimes it gives me false confidence on things that I should've tested more throughly (be it through unit testing or just running the program) oh also I get it that people like to use the compiler for refactoring like say renaming variables/functions and I see why it's annoying for them when they try doing something similar in a dynamic language.
|
# ? Jan 31, 2019 23:36 |
|
try catch is the dream of large scale python until you meet something new or something you didnt think of and your world collapses
|
# ? Jan 31, 2019 23:37 |
|
Scionix posted:Ok thank you people trying to explain python to me. btw I think ned batchelder got the best material on this, he has great examples: https://nedbatchelder.com/text/names1.html
|
# ? Jan 31, 2019 23:49 |
|
Symbolic Butt posted:I don't have the audacity to say that I "manage to make it work well" because well I'm a Terrible Programmer, but I seriously don't get much out of the compiler when I do C++ compared to python. In some sense I feel like sometimes it gives me false confidence on things that I should've tested more throughly (be it through unit testing or just running the program) yeah it's refactoring that's the problem. not just renaming but also changing signatures. like if you realise a method needs to take two parameters instead of one, in java you add the parameter to the method and then the compiler immediately tells you every other place you need to change to match it. in python you just don't have that because most static analysis tools aren't smart enough to do much beyond "here's a place where a method of the same name was called with one parameter", it can't be sure if it's actually the same method or not so it's up to you to figure out what needs to change. duck typing also brings pain to undisciplined programmers because nothing forces you to record what assumptions your code is making. in languages like java you have to say explicitly what your interfaces are and what calls them and what implements them, and the compiler yells at you if you deviate from that. in python you can just write code that uses an implicit interface and pass it objects that implicitly match that interface and it all just magically works, which is great because you can write all the code instead of wasting time pacifying the compiler, and you feel super-productive. and then you forget the details or accidentally make things inconsistent, and now your code is an unmaintainable mess and you don't have a clue how all the parts fit together. or at least that's my experience as a terrible programmer. and sure, tests can help - but the problem with tests is that they're optional and so idiots don't always bother writing them, and sod's law dictates that the test that doesn't get written is the one that would have caught the bug you're trying to fix. static typing may only be able to prevent a tiny subset of the bugs proper testing can catch, but the fact that it's not optional means it's automatically a million times more useful to me.
|
# ? Feb 1, 2019 00:23 |
|
I was writing a toy script in Python and was trying to figure out how I could get a function to only work on the proper sort of thing I wanted it to and then had an epiphany
|
# ? Feb 1, 2019 01:15 |
|
How about guython and it's a programming language just for the fellas
|
# ? Feb 1, 2019 01:26 |
|
you can apparently annotate types since 3.5 but it seems pretty doomed when you have to import a module and use a third party (i think) tool to check them imo https://docs.python.org/3/library/typing.html Carthag Tuek fucked around with this message at 01:53 on Feb 1, 2019 |
# ? Feb 1, 2019 01:51 |
|
Apparently the people who started this webapp thought that if you're using a MVC framework, your entire app can only contain models, views and controllers. There's a comment here that states something to the effect of "here's a function but we have no classification for it so it's being kept here in this random class do not worry kthx". Like it would have killed them to just make a simple class to store it but nope MVC MEANS MVC ONLY
|
# ? Feb 1, 2019 03:00 |
|
Krankenstyle posted:you can apparently annotate types since 3.5 but it seems pretty doomed when you have to import a module and use a third party (i think) tool to check them imo mypy is like 1.5 party, guido pops in occasionally
|
# ? Feb 1, 2019 03:21 |
|
c tp s: I'm trying to (desperately) make sure I never have to touch CMake again (this is a lie, but if it means I have to touch it less often then its worth it) by writing a library that does the common operations everyone does in CMake automatically. Even a few of the maintainers are keeping an eye on it. This means I've been deep into CMake and know it to a degree that the average mere mortal is nowhere near understanding. So here's a
How am I getting this loving shitshow of a library out to people? They put a FetchContent call at the top of their build file and watch the fireworks. You'll only ever use like 5, maybe 6, commands unless you're doing some wacky poo poo like generating an ar script as a hack or whatever. I loving hate cmake
|
# ? Feb 1, 2019 05:12 |
|
that is an impressive amount of hate i'm sorry
|
# ? Feb 1, 2019 05:31 |
|
floatman posted:Apparently the people who started this webapp thought that if you're using a MVC framework, your entire app can only contain models, views and controllers. haha nice. I remember when I first started fiddling with mvc I thought the same thing until I realised that I could just ~create another class directory in the solution~ for common methods or whatever and use a sensible namespace and it was all cool so sfyl I guess
|
# ? Feb 1, 2019 09:36 |
|
in other mvc news our "new" dev has now spent close to two weeks rewriting a page that should take at most a couple of days and the checked in code is still riddled in commented out lines and a completely separate set of duplicative controller routes "used for debugging" like seriously you just need to pass 4 params to a route, apply one filter to a list and return it. that's it. instead we have nonsensical nested if statements that perform the same operations and half of the params passed via a form submit and the others by manual js. this will be the third person offshore I feel like I've ended up "training" to not write total garbage. if he hasn't tidied it up today I'm just gonna refactor it myself.
|
# ? Feb 1, 2019 09:44 |
|
Powerful Two-Hander posted:this will be the third person offshore I feel like I've ended up "training" to not write total garbage. Farkin hell this makes me relieved our lovely PM won't let me look at our offshore vendors code. They can't figure out how to send a PATCH to a REST endpoint lol
|
# ? Feb 1, 2019 11:51 |
|
our external actually-passable-PHP devs can't seem to figure out how to make an API consisting of two simple endpoints accept the same input as before after a backend update instead I have to go through a dozen separate deployed C/C++ (ok a few are python) applications where we call the API and 'sanitize' the input into the new format we paid them £20k for the attempt what I'm saying is that I should try freelancing probably e: I get paid a bit over ~£30k a year because European computer toucher wages suck, for comparison Private Speech fucked around with this message at 12:29 on Feb 1, 2019 |
# ? Feb 1, 2019 12:23 |
|
|
# ? Feb 1, 2019 12:28 |
|
Private Speech posted:e: I get paid a bit over ~£30k a year because European computer toucher wages suck, for comparison move to london if you haven't already, i got double that after 2 years experience
|
# ? Feb 1, 2019 12:52 |
|
Slurps Mad Rips posted:c tp s: I'm trying to (desperately) make sure I never have to touch CMake again (this is a lie, but if it means I have to touch it less often then its worth it) by writing a library that does the common operations everyone does in CMake automatically. Even a few of the maintainers are keeping an eye on it. This means I've been deep into CMake and know it to a degree that the average mere mortal is nowhere near understanding. So here's a this whips rear end, i hate cmake
|
# ? Feb 1, 2019 13:00 |
|
Soricidus posted:yeah it's refactoring that's the problem. not just renaming but also changing signatures. like if you realise a method needs to take two parameters instead of one, in java you add the parameter to the method and then the compiler immediately tells you every other place you need to change to match it. in python you just don't have that because most static analysis tools aren't smart enough to do much beyond "here's a place where a method of the same name was called with one parameter", it can't be sure if it's actually the same method or not so it's up to you to figure out what needs to change. I'm impressed, this and the one before were really good posts.
|
# ? Feb 1, 2019 13:16 |
|
Private Speech posted:
gonadic io posted:move to london if you haven't already, i got double that after 2 years experience yeah what the gently caress dude 30k is super low. though tbf spending £££ on offshore people or fixed priced vendor consultants instead of hiring decent people to do the job which provide long term benefits to the company still happens all the loving time because all the accountants see is "resource x is cheaper than resource y" regardless of whether their delivery is remotely comparable.
|
# ? Feb 1, 2019 13:20 |
|
Stringent posted:I'm impressed, this and the one before were really good posts. Yeah, this made me realize that Go is a billion times better than python. Just don't get me started on the error handling and those loving channels that are supposed to simplify concurrency. I learned this last sprint I would've been better off skipping the channels and just using locks/semaphores/etc. Would've saved me some headaches, and the code would've been a lot easier to maintain/follow, I think. I also learned CTO is terrible at writing maintainable code and whoa big surprise he's a hardcore python dev. After code reviewing some of my Go code he decided to spend pretty much the entire sprint rewriting/refactoring his own Go project to make it more readable. Well, I guess that's something
|
# ? Feb 1, 2019 13:27 |
|
Powerful Two-Hander posted:yeah what the gently caress dude 30k is super low. though tbf spending £££ on offshore people or fixed priced vendor consultants instead of hiring decent people to do the job which provide long term benefits to the company still happens all the loving time because all the accountants see is "resource x is cheaper than resource y" regardless of whether their delivery is remotely comparable. my jobs have varied between £30k and £36k over the years, including for a multinational, though yeah it was outside London I wouldn't even say it's super low, if you look at indeed 30k-40k is the typical wage for non-lead devs outside London, even <30k for web devs e: a fairly typical junior webdev ad outside London looks like this quote:Qualifications or this: quote:Full Stack PHP Developer US folks don't know how good they have it (I'm an embedded/linux dev myself, not PHP, but it's the same just £10k higher) Private Speech fucked around with this message at 13:52 on Feb 1, 2019 |
# ? Feb 1, 2019 13:30 |
|
Finster Dexter posted:Yeah, this made me realize that Go is a billion times better than python. Just don't get me started on the error handling and those loving channels that are supposed to simplify concurrency. I learned this last sprint I would've been better off skipping the channels and just using locks/semaphores/etc. Would've saved me some headaches, and the code would've been a lot easier to maintain/follow, I think. if you think go is a substitute for python, you're a terrible programmer they're for wildly different things (inasmuch as either of them are "for" anything) coding blows
|
# ? Feb 1, 2019 13:45 |
|
go is bad, python is bad, all langs are bad hth
|
# ? Feb 1, 2019 13:48 |
|
e:
|
# ? Feb 1, 2019 13:49 |
|
Rust is good because it forced c++ to modernize.
|
# ? Feb 1, 2019 13:52 |
|
Finster Dexter posted:Yeah, this made me realize that Go is a billion times better than python. Just don't get me started on the error handling and those loving channels that are supposed to simplify concurrency. I learned this last sprint I would've been better off skipping the channels and just using locks/semaphores/etc. Would've saved me some headaches, and the code would've been a lot easier to maintain/follow, I think. Well ok, maybe they weren't so good.
|
# ? Feb 1, 2019 13:55 |
Private Speech posted:my jobs have varied between £30k and £36k over the years, including for a multinational, though yeah it was outside London you could move to latvia and make more. no, im not joking.
|
|
# ? Feb 1, 2019 14:05 |
|
ive never made 30k but most people i know do
|
# ? Feb 1, 2019 14:17 |
|
Private Speech posted:
wat? According to google, my yearly eastern european salary is ~40k gbp Also I've finished my eng. degree last January.
|
# ? Feb 1, 2019 14:35 |
|
I only have a few years experience (and a degree) but yeah I dont get why more companies dont outsource to non-metropolitan UK
|
# ? Feb 1, 2019 14:38 |
|
we pay fresh grads more than 30k (like way more, maybe 40 now idk) but yeah that's in London Private Speech posted:I only have a few years experience (and a degree) but yeah I dont get why more companies dont outsource to non-metropolitan UK There is (was?) a trend of financial companies moving IT out of London to various places but it only works if you have the scale to do it and can pay relocation etc. can't remember any examples off the top of my head, also quite a bit in Ireland as "nearshoring" as everyone slowly cottons on to offshoring being a total disaster.
|
# ? Feb 1, 2019 14:42 |
|
Captain Foo posted:if you think go is a substitute for python, you're a terrible programmer I didn't say they were substitutes. I'm merely commenting on the design of each language. Python is bad in its intended space. Go is bad in its intended space, but somewhat less so. Typescript is better than python even though they are intended for completely different problems.
|
# ? Feb 1, 2019 14:48 |
|
maybe private speech is talking post-tax figures?
|
# ? Feb 1, 2019 14:49 |
|
Finster Dexter posted:I didn't say they were substitutes. I'm merely commenting on the design of each language. Python is bad in its intended space. Go is bad in its intended space, but somewhat less so. Typescript is better than python even though they are intended for completely different problems. go is unredeemable trash, though
|
# ? Feb 1, 2019 14:51 |
|
NihilCredo posted:maybe private speech is talking post-tax figures? im not, nor are the jobs ive posted i guess if you go fintech or something you can get more, also racism could play a role a bit maybe seeing as im slav even if my degree and work history is in the uk anyway im not complaining too much, its enough to live on comfortably when paying half the rent id pay in london. I might even be worse off at ~46k in London once london rent and higher effective tax rates are taken into account Private Speech fucked around with this message at 14:57 on Feb 1, 2019 |
# ? Feb 1, 2019 14:52 |
|
|
# ? Dec 6, 2024 01:37 |
|
Captain Foo posted:go is unredeemable trash, though I... can't disagree... and I also think python is worse
|
# ? Feb 1, 2019 14:54 |