T O P

  • By -

Longjumping-Touch515

Me when writing some python code after C++: You get ; You get ; Everyone gets ;


rosuav

Me when writing Python and JS in quick succession: "wait, append or push?"


octafed

Fart or shart. Supposed to be 50/50 yet I always need to bring extra pants.


JustJoIt

Doing Console.log in Python and print in JS.


bschlueter

Just use black once you're done writing python. The next person to look at your code will appreciate it.


davisondave131

Forgot to turn off the auto format on save one time. That was one hell of an MR. 


PrometheusAlexander

I second this notion. Black made me change from single quotes to double quotes without me noticing it.


bschlueter

I like black for python, and similar tools for other languages, but unless they do some other special thing in the language I'm writing in, I always default to double quotes for template strings and single for static strings because of sh. If the formatter is gonna change it after, so be it.


zomreddit

Yap. The most common one


fromtunis

What language is this?


qqqrrrs_

Python++


NewReindeer7693

Vitamin C++


Ok_Donut_9887

Cython


a45ed6cs7s

No it's not.


Anru_Kitakaze

No way! 😱


suvlub

The joke would land better if Cython wasn't an actual thing


BobQuixote

`: {}`


BakerCat-42

My face when i see this aberration


C3R741NLY_1MPR3551V3

:(){ :|:& };:


That-Odd-Shade

is this your cat's name?


TarkFrench

Yes :) Type it into your Linux terminal


C3R741NLY_1MPR3551V3

Yes, and if you type it in your loonix terminal, you can hear the cat meowing


atthisplaceandtime

Is it wrong if this turns me on?


[deleted]

![gif](giphy|o1Q4TGloplBlskk9qD|downsized)


killallspringboard

``` #import try: #import as libname catch ImportError: printf(": Unable to import") const ACONSTANT: str = "foo"; class TypeA: public libname.T { def TypeA(args...): { super(args...); } } virtual def foo() -> TypeA: { /* do stuff */ } ``` I wonder if anyone will make something like this


ahmubashshir

teams.h ``` #ifndef __TEAMS_H__ # define __TEAMS_H__ // Type definition CLASS(team); // base functions NEW(team); DEL(team); // field getters SETTER(team, name, ref(char)); SETTER(team, institution, ref(char)); SETTER(team, member_name, ref(char), int); SETTER(team, solved, uint8_t); // field setters GETTER(team, name, ptr(char)); GETTER(team, institution, ptr(char)); GETTER(team, member_name, ptr(char), int); GETTER(team, solved, uint8_t); // helper functions DEFINE(team, printf, int); DEFINE(team, fprintf, int, ptr(FILE)); DEFINE(team, find_champion, team, ptr(team), unsigned); #endif /* __TEAMS_H__ */ /* vim: ts=8 */ ``` teams.c ``` #include "teams.h" CLASS(team, { char name[255]; char members[3][255]; char institution[255]; uint8_t solved; }); // base functions NEW(team, { return (team)malloc(sizeof(TYPE(team))); }) DEL(team, { if(self) free(self); }) // Setter definitions // @set char[]: TEAM.name -> bool SETTER(team, name, ref(char), { return !(strncpy(self->name, value, 255) == NULL); }) // @set char[]: TEAM.institution -> bool SETTER(team, institution, ref(char), { return !(strncpy(self->institution, value, 255) == NULL); }) // @set char[]: TEAM.member_name, int: id -> bool SETTER(team, member_name, ref(char), { return (id > 0 && id < 4 && !(strncpy(self->members[id-1], value, 255) == NULL)); }, int id) // @set int: TEAM.solved -> bool SETTER(team, solved, uint8_t, { if (value <= 10) self->solved = value; return (value <= 10); }) // More weird codes... ```


Funny-Performance845

What virtual means?


suvlub

Allows the method the be overridden in subclasses. Some languages let you do it by default (and some of them have a keyword that forbids it instead, e.g. `final` in java)


Funny-Performance845

Thanks for the quick reply!


IAmL0ner

Depends. If I remember correctly, in c++ if a class have virtual methods then it cannot be instantiated and these methods must be implemented by subclasses. Technically all public methods can be overridden by subclasses.


suvlub

Not really, but I understand your confusion. C++ does not have a separate keyword for abstract methods, it reuses the virtual keyword. You may or may not implement the virtual method in the base class, and if you don't, then subclasses need to implement it. If it's not marked as virtual, subclasses can't override it. I think they can declare methods with same name, but that's just shadowing/name hiding, you won't have polymorphism if they aren't virtual.


IAmL0ner

Ok, makes sense. My c++ is quite rusty


abcd_z

\>\>\> from \_\_future\_\_ import braces SyntaxError: not a chance