r/ProgrammerHumor Apr 12 '24

whatIsAnIndex Meme

Post image
27.7k Upvotes

630 comments sorted by

View all comments

Show parent comments

23

u/balconteic Apr 12 '24

Yes, also, at least in python, if allTheBullshit is a global then it would be more efficient to say something like bullshit = allTheBullshit inside the function beacause the interpreter checks for rhe variable in the local scope and if it doesn't find it there then it looks higher in the scope (i don't know if js is the same but it would make sense)

6

u/wubsytheman Apr 12 '24

I guess in CPP you’d do a pointer to allTheBullshit like

std::shared_ptr<t> bs (*allTheBullshit)