3 ms·
Yeah, I've definitely developed an aesthetic taste for code cleverness. Like, one time I was writing some python and using third-party code that expects a list
by ThrustVectoring 10y ago
Yeah, I've definitely developed an aesthetic taste for code cleverness. Like, one time I was writing some python and using third-party code that expects a list of user-provided classes. It was really annoying and I kept passing it a bare class which made things fail. I ended up making a class that behaves like a list containing itself, and it completely "fixed" the problem. That really shouldn't be production code, though.
- hex13 10y agoWhy didn't you just pass one element list with your class with it, for example: class MyClass: pass class_list = [MyClass] third_party_function(class_list) # or just third_party_function([MyClass]) ? creating some simple wrapper for third party function, e.g. def wrapper(C): third_party_function([C]) could also be much simpler solution :) But it's maybe off topic.