Recently I tried making a web application in Django and found Python to be baffling because I couldn't find in any book/tutorial how to write a goddamn class method. And the dude made it seem like it was a totally obscure and pointless question. I don't know how to accomplish anything without them. Python is whack. The only reason I used it is because it sort of resembles Ruby but isn't as slow as a turd like Ruby is.
Class methods are very necessary. Sometimes I want to accomplish something that is related to a particular class but not an instantiated object. Is that too much to ask?
>>10
not necessarily... it could be a digital clock and be broken in such a way as to not display any time at all.
also, you're an EXPERT PROGRAMMER, your code is SQL.
#inside some class
@classmethod
def lol(cls, stupid):
if stupid:
print "Yes you're stupid"
Of course that's a class method, which may not be what you're looking for. It receives the class of the object used to call it as first param. If you want a static method, which receives no class, use @staticmethod .
>>10
No, if you can do SQL. Declarative language > OO imperative language, even if the former is ugly. The kind of shit you can do with SQL makes life easier, and then you can easily treat the results it as a value, a list, or a table.
| ID:WEbAIB0T
Please tell me this ID isn't forged.
Name:
Anonymous2007-07-21 14:26 ID:y1KPqM5A
No, if you can do SQL.
Well, see, I can do SQL just fine. It's just that it makes refactoring a nightmare with SQL interspersed throughout the code. I've worked on non-trivial apps that do things the old way, and it's ugly.
ORM has problems, but it does one thing nicely: it isolates the SQL away from everything else.
The kind of shit you can do with SQL makes life easier, and then you can easily treat the results it as a value, a list, or a table.
Uh... I don't think you've used ORM. If you have, and you still believe the above, then it was probably something hamstrung.
Name:
sli2007-07-21 15:14 ID:Rpn9W2/u
class ClassName:
def __init__(self,arguments,go,here):
self.arguments = arguments
self.go = go
self.here = here
--------------
Output:
--------------
hello
mr.
4chonz
Name:
Anonymous2007-07-21 18:01 ID:ydGRMLIJ
Purebasic
Name:
Anonymous2007-07-21 21:14 ID:Nz8HKjSm
>>17
Ok, let's see how you do a selection of certain group and non-group functions applied to a group by of several joined tables (some with outer joins, some with inner joins) with rollup, ordered by three different criteria, one of them functional and descendent with an ORM.
Name:
Anonymous2007-07-22 14:43 ID:ercKe2jm
>>20
zOMG wrap the SQL up in a single method call.
Wow, what a hard solution to a corner case. Can you flaunt your ignorance any harder?
Name:
Anonymous2007-07-22 18:39 ID:Ow+NwxWK
>>21
Then you're writing SQL and mixing it with your code you fucking retard! If you're willing to do that, then why are you bitching?
Name:
Anonymous2007-07-22 19:48 ID:ercKe2jm
>>22
Hello Captain Obvious: isolation, locality, and a large degree of automation.
I'm convinced you're a PHP moron. Everyone else has seen the light.
As far as I know, they're generated randomly from the IP address and current time (quantized to a few hours), so you can tell if you are responding to the same Anonymous.