|
uG posted:420 write my own string libraries every day this kind of poo poo is academic programming from high school interns through to senior faculty
|
# ? Jul 17, 2013 17:13 |
|
|
# ? May 25, 2024 14:12 |
|
that awful moment when you look at your own code from a few months ago and have no loving clue what it does and you didnt write a single comment and you knew full well at the time the sort of atrocities you were committing against your future self but didnt care enough to not commit them
|
# ? Jul 17, 2013 18:27 |
|
Bloody posted:that awful moment when you look at your own code from a few months ago and have no loving clue what it does and you didnt write a single comment and you knew full well at the time the sort of atrocities you were committing against your future self but didnt care enough to not commit them i don't think i've ever written code that i found pleasing to the eye two weeks later
|
# ? Jul 17, 2013 18:28 |
|
prefect posted:i don't think i've ever written code that i found pleasing to the eye two weeks later i dont even know what most of these functions do hell i even documented one of them and i still dont know what the input data is supposed to be it doesnt help that its c so the parameters are just pointers to... something.
|
# ? Jul 17, 2013 18:29 |
|
Bloody posted:i dont even know what most of these functions do code:
|
# ? Jul 17, 2013 18:48 |
|
Bloody posted:i dont even know what most of these functions do post yr code
|
# ? Jul 17, 2013 18:51 |
|
don't try n clean it up first either
|
# ? Jul 17, 2013 18:51 |
|
i dont think i legally can unfortunately
|
# ? Jul 17, 2013 18:53 |
|
Bloody posted:i dont think i legally can unfortunately my code is also prohibited by the geneva convention
|
# ? Jul 17, 2013 19:02 |
|
wrong drat thread
|
# ? Jul 17, 2013 19:06 |
|
Bloody posted:i dont even know what most of these functions do I use java and c# and their general naming conventions so my code is self documenting.
|
# ? Jul 17, 2013 19:49 |
|
Shaggar posted:I use java and c# and their general naming conventions so my code is self documenting. how do you sleep at night must be hard, knowing there is so much wrong in the world.. if only the ycould see that shaggar is right
|
# ? Jul 17, 2013 20:12 |
|
coffeetable posted:this kind of poo poo is academic programming from high school interns through to senior faculty lol if you only ever program poo poo that handles all your unicode string poo poo automatically that sounds very exciting
|
# ? Jul 17, 2013 20:19 |
|
ascii unicode 8 16 conversion is what I live for, truly I live a king's life My habit, as a biology turn beep boop person, was to write way too many comments. I document exactly how code does stuff including each for loop in 6 nested loops Then I realize I wrote it and feel ashamed, then everyone else can see it too because it's committed.
|
# ? Jul 17, 2013 20:30 |
|
never commit, only blame
|
# ? Jul 17, 2013 20:32 |
|
you're a wizard, array
|
# ? Jul 18, 2013 02:43 |
|
prefect posted:i don't think i've ever written code that i found pleasing to the eye two weeks later dont you write perl
|
# ? Jul 18, 2013 03:15 |
|
chumpchous posted:dont you write perl lol
|
# ? Jul 18, 2013 03:37 |
|
c software update s: everything went better than expected. only took a few hours. tests have been running for as long as development took at this point. the fact that they are still running is a good sign.
|
# ? Jul 18, 2013 04:08 |
MeruFM posted:ascii unicode 8 16 conversion is what I live for, truly I live a king's life Lol 6 nested for loops Time to refactor bro
|
|
# ? Jul 18, 2013 04:17 |
|
AppleCobbler posted:Lol 6 nested for loops sometimes you need to exhaustively traverse 6-dimensional space don't 6d-shame please this is a safe place
|
# ? Jul 18, 2013 05:15 |
|
chumpchous posted:dont you write perl not in the past few years, actually. i miss it
|
# ? Jul 18, 2013 12:04 |
|
I ran into this "problem" with Python scoping. I know that Python uses statical scoping but that doesn't really work that well with the lambda keyword. What does the following program output? code:
b) 5 c) -1 Answer: b) 5
|
# ? Jul 18, 2013 12:12 |
|
Python code:
No, I can't explain why lambda is such a piece of poo poo in python other than mumbling "lexical scope and closure or something". My rule of thumb is that if I want to do something fancy like I would in racket it'll go wrong in python.
|
# ? Jul 18, 2013 12:43 |
|
also there's functools.partial, it never disappointed me unlike loving lambda
|
# ? Jul 18, 2013 12:51 |
|
Python code:
Python code:
Python code:
Symbolic Butt posted:"lexical scope and closure or something"
|
# ? Jul 18, 2013 14:54 |
|
qntm posted:
could somebody explain why the first is okay but the second is bad?
|
# ? Jul 18, 2013 14:58 |
|
bc Python isn't very good
|
# ? Jul 18, 2013 15:02 |
|
Seriously languages without decent scoping/declaration rules why even bother ffs
|
# ? Jul 18, 2013 15:14 |
|
Bizarro Buddha posted:Seriously languages without decent scoping/declaration rules why even bother ffs i haven't done enough with python to be fully comfortable with it, but i do not like their scoping rules. i understand block scoping; it makes sense to my dumb brain. the curly braces will show you the truth
|
# ? Jul 18, 2013 15:15 |
|
Symbolic Butt posted:
as usual, c++ is expressive enough to let you define just the closure you need C++ code:
|
# ? Jul 18, 2013 15:23 |
|
oh hey the same thing already posted from 2 pages agoJewKiller 3000 posted:
prefect posted:could somebody explain why the first is okay but the second is bad? the way I understand is when you do i += 1 inside a block it's like: - oh hey is there some name assignment around here? yes. yes there is. gently caress the corresponding nonlocal plebs - creates new name i - tries to assign (i + 1) to i - oops can't evaluate this expression coz there's nothing in i yet!
|
# ? Jul 18, 2013 15:44 |
|
prefect posted:could somebody explain why the first is okay but the second is bad? Wow what the gently caress?? Does it work if you do i = i + 1?
|
# ? Jul 18, 2013 16:20 |
|
chumpchous posted:Wow what the gently caress?? sorry. guess i missed a page
|
# ? Jul 18, 2013 16:21 |
|
prefect posted:sorry. guess i missed a page No I'm just amazed
|
# ? Jul 18, 2013 16:22 |
|
chumpchous posted:Wow what the gently caress?? http://repl.it/languages (no, because the problem isn't with the += operator) e: lotta words if anyone cares http://stackoverflow.com/questions/370357/python-variable-scope-question coffeetable fucked around with this message at 16:32 on Jul 18, 2013 |
# ? Jul 18, 2013 16:29 |
|
chumpchous posted:Wow what the gently caress?? no also this returns the same error without any prints: Python code:
|
# ? Jul 18, 2013 16:30 |
|
yeah basically that behavior is to discourage people from using/modifying nonlocal variables without being very explicit about it, to help avoid confusion about where exactly symbols are coming from (confusion on the part of maintainers, not the machine) the same thing happens if you try to assign to a global variable within a function (but lol if you use global variables) in both cases, python (3, the one true python) provides a way to explicitly specify nonlocal variables that you're going to modify within an inner scope: "nonlocal foo[, bar[, baz...]]" (or in the case of globals, 'global foo' etc) it's slightly counterintuitive when you first run into it, but I can see why they did it re the lambda example: we actually had a thread about closures & such a few months back. might have had a discussion in this very thread, I forget. anyway, if memory serves, you can get the behavior you want by doing something like code:
code:
I like closures I like python PleasingFungus fucked around with this message at 17:34 on Jul 18, 2013 |
# ? Jul 18, 2013 17:31 |
|
PleasingFungus posted:yeah basically that behavior is to discourage people from using/modifying nonlocal variables without being very explicit about it, to help avoid confusion about where exactly symbols are coming from (confusion on the part of maintainers, not the machine) Closures are a poor man's object. Objects are a poor man's closures.
|
# ? Jul 18, 2013 18:03 |
|
|
# ? May 25, 2024 14:12 |
|
PleasingFungus posted:
I see what's happening in the case of the named function and when you try to use it but it still baffles me in the case of the lambda, it's like they aren't really anonymous or something.
|
# ? Jul 20, 2013 05:54 |