IT/Software career thread: Invert binary trees for dollars.

chaos

Buzzfeed Editor
17,324
4,839
I only vaguely knew there was a thing called a lambda, I had to dig into it. Still not sure I would use it, but I think that's because I'm not on his level. My use cases are pretty simple.
 

Deathwing

<Bronze Donator>
16,434
7,447
Nice usage for lambdas is optional callable parameter to a function. You've got a dictionary full of stats while your program runs. Some stats, as new numbers are recorded, you'd like to keep the biggest one:

self.add_stats(key, value, lambda x, y: max(x, y))

Or, you want to simply add the new numbers to existing stats:

self.add_stats(key, value, lambda x, y: x + y)

And in def add_stats(), you'll have code that handles that callable if it exists. X being the existing stat, and Y being the new value being passed in. Sure, you can do this with an array of flags, but lambdas allow for much great flexibility with much less code. Downside is that lambdas are somewhat expensive since you're creating a new function every time add_stats() is called. But, hey, it's python, not exactly known for performance.
 

Deathwing

<Bronze Donator>
16,434
7,447
I would say less important these days since the performance of modern computers allows scripting languages to grow and encroach on what would typically be a program. The large majority of our testing system is written in Python.
 

chaos

Buzzfeed Editor
17,324
4,839
Yeah I do scripting but it seems like the difference between a script and a program, these days, it just scale. Apparently you can even write a gui in python, which I had no idea until a few weeks ago.

It's a strange thing, because I want to know it, and I need to know it. But I don't need to know it to that level so I'm kind of uncertain about how far to take it before that's done and I can focus on some other shit. Course I'm taking wants me to learn some assembly and C as well, same problem there.
 

Deathwing

<Bronze Donator>
16,434
7,447
The game EVE Online was written in python. Not sure if they have ever migrated off it.
Just because you can doesn't mean you should. I think some of the performance problems in Civ5's late game was also caused by Python. There's still a limit as what you should do with a scripting language, just that limit is defined by the hardware and how fast you want your application to be.
 

tyen

EQ in a browser wait time: ____
<Banned>
4,638
5,164
We had a plastic bag ban in Dallas too and Dallas is hardly some hipster haven.

BAGS Wakandan

UN5gPy8.jpg
 

Noodleface

A Mod Real Quick
37,961
14,508
It's similar to any other type of programming really just everything is super inconvenient and difficult.
Well sort of.. You have to break away from the typical thinking of 'I'll toss a for loop here, and if statement here' . You have to manually write that stuff.

Granted i did it at a way lower level than most people would so perhaps my view is skewed. In school we had some boards that ran old Motorola assembly and it was fun but incredibly taxing on my brain.

Im very fast at reading and understanding assembly now but if you asked me to write anything it would take me forever.


At the new place I'm mainly doing C++, Java, and Matlab for signal processing and its a nice break from the Super low level stuff


tyen tyen aren't you from Portland? Not surprising you'd like hipster Central. I might not have minded it if my commute wasn't 2 and a half hours one way everyday.
 

alavaz

Trakanon Raider
2,001
713
Assembly (in my limited experience) is quite a bit different than higher level programming. The instructions are very rudimentary and you have to actually be concerned about memory location and register placement and very low level things. It seems to me that it would take millions of lines of code to do relatively basic stuff, but as I said my experience is limited.
 

Noodleface

A Mod Real Quick
37,961
14,508
No you're spot on. And not only memory locations but also very careful with the stack and some other things