User Controls
Thanked Posts by Lanny
-
2018-03-26 at 7:51 AM UTC in What is the purpose of a Class.That's kind of a big question to answer in a comprehensive way. The mechanics of classes aren't too complex, it's more that the question digs into deep and varied cultural flows that have been in force in socialized programming for almost half a century now.
The dry textbook answer of "what is a class" is that it's a specification of a certain kind of object. A class is an archetype with a fixed collection behaviors (methods/functions) and data fields. Classes can be "instantiated" into objects that have actual values in their data fields.
It's kind of unfortunate that pretty much none of that is literally true in python since classes are objects, objects can dynamically acquire or replace fields or methods, and some classes can not be instantiated. But that's kind of the way you want to think about it, an archetype for objects which hold data and define some set of methods over that data. There's plenty of deep magicks around how classes/objects work but stick to the simple case to start. Like the string class is probably something you've worked with many times before. The string class is the thing that defines string behavior, like the `.split()` method for example. `.split()` is defined once for all strings by the class, but every string instance has different data (e.g. the string "foo" has different data than the string "bar"). A class is the "blueprint" that specifies the things all string instances have in common.
To individual questions:
Originally posted by Sophie but what the hell does a class do that a function can't?
Not much really. Classes are more of an organizational tool than anything else. Consider the file class. In python you can do things like:
myFile = open('foobar.txt', 'w')
myFile.write('foo')
myFile.close()
Note that `write` and `close` are methods of your file instance. Back in the C days you'd write the same code like:
int myFile = fopen("foobar.txt", "w");
write(myFile, "foo", 3);
fclose(myFile);
Here you're calling global functions `write` and `fclose` and you have to tell them which file you're operating on as the first arg. The way this looks on the reverse side is something like:
class File(object):
def __init__(self, filename, mode):
self.file_descriptor = open(filename, mode)
def write(self, input):
write(self.file_descriptor, input)
def close(self):
fclose(self.file_descriptor)
def open(filename, mode):
return File(filename, mode)
Is this use of a File class really any different than using functions where you're continually telling the function which data (file, in this case) you're operating on? I don't think so really. There are some very, uhh, base issues here with namespace pollution. Like if I define a `fopen` method to "forum open" some kind of thing representing a forum then I'm going to have name collision while if I'm using classes I only need to ensure my class name is unique.
Now mind you we figured out how to do non-shit namespacing sometime between C and Python (and Java falls on this shit side IMO) so it's less of an issue but if you think about like the python REPL you can do `dir(myFile)` to find out all the methods you can call on myFile. There is no equivalent in C, you just have to know which functions operate on file descriptors, so there is a discoverability advantage in classes and OOP but this is a human ergonomics issue, not a technical one.
But the key idea here is that File objects hold data (like file_descriptor) internally, each file will have its own file_descriptor that it remembers through `self` but they all share their write and close methods.Also, if you have a class why do i need to define __self__ and self.object and whatnot
You as a programmer should never have to manually specify __self__ properties, if you're doing this you're probably failing to instantiate a class first. Can you give us an example of where your'e doing this?but if i use a `@staticmethod` decorator i don't. What's the deal with that?
The staticmethod decorator is kind of an oddity. It's inherited from java. In java "everything is an object" (except some things because java is an ugly hack) derived from a class. If you want a function that isn't a method in Java the only way to do it is to make a static method which can be called without instantiating an associated object. Since python lets you declare functions which are not methods of objects the only reason to use a static method is for namespacing (your <function> is now `<Class>.<function>` so you can have like `File.open()` and `Trashcan.open()` in the same file without name collisions).
Consider applying the staticmethod decorator to the file class above. The write and close methods won't know which file descriptor to operate on, so you'd have to add an additional argument to communicate to them which file you want to close or write to. -
2018-03-26 at 3:45 AM UTC in Can we have a "preview" option next to "submit"?Yeah, sounds like a good idea. I've added it for posts. Still need to generalize it the new thread and edit pages but you can fiddle with it now. Let me know if you have any issues or want to see something different.
-
2018-03-26 at 6:23 AM UTC in Was The Self Taught Man ever an original user?Yeah, there was never a user with that name on this site. Could have been on previous sites but I've never heard of them. It's these:
Originally posted by greenplastic I always thought it was some sort of philosophy reference or some shit
Originally posted by benny vader lanny said its a character from some french novel or something.
its in a thread somewhere. -
2018-03-26 at 5:54 AM UTC in The Retardest Thread: Fashionably Late Edition.
-
2018-03-26 at 2:02 AM UTC in wdfdat necrobump. I thought bling had returned from jail or space or wherever the fuck that nigga be.
-
2018-03-25 at 1:11 AM UTC in We have a moral obligation to stop eating meatWhat would make me happy is another 40 pages of this thread at the end of which no one has changed their opinion
-
2018-03-19 at 7:49 AM UTC in Some weeb shit
-
2018-03-23 at 8:35 PM UTC in We have a moral obligation to stop eating meatWear it on your head like a hat and cruise on down to the beach like a baller with your new jellyfish bud
-
2018-03-24 at 4:03 AM UTC in The Retardest Thread: Fashionably Late Edition.
-
2018-03-23 at 7:24 AM UTC in The Retardest Thread: Fashionably Late Edition.
Originally posted by aldra making people ejaculate over ip would be a strange power to have
The future is here my dude -
2018-03-06 at 2:38 AM UTC in We have a moral obligation to stop eating meat
Originally posted by infinityshock genetic engineering is not categorically bad. genetic engineering involving manipulation of the genome followed by virtually immediate release…literally…into the wild with little to no oversight and safety precautions…is bad.
Fine, can you show that this characterizes soy crops today?40 years. thats funny. funny in the way that a nigger crossing the street getting hit by a bus going 80mph is funny. go look into the facts and how quickly a GM organism goes from lab to in-the-dirt planting with inadequate quarantine boundaries.
Yeah, like a decade of development and testing for an individual crop bro. 40 years is how long we've been creating GM organisms for.youre doing it again…comparing apples to hand grenades. soy protein isolate is not soy protein. if youre going to invoke isolates then other protein type isolates or concentrates can be brought into the equation which will send soy straight to the bottom of the list…surpassed in shit-tier protein quality only by collagen protein. soy protein has one of the worse calorie-to-protein ratio of all protein types. theres a reason soy protein is the cheapest. its shit.
Shifting goalposts. The question has never been "is soy nutritionally superior to meat". You started this by claiming you can't have a nutritionally sufficient diet without animal products. You were wrong, now you're trying to argue something else.
The fact remains that you can satisfy your protein requirements with soy better than any historical omnivore ever could.you dont have to cringe just yet…you still have some fattening up to do before you find yourself tied to a spit, rotating over an open fire with a nice juicy apple crammed into your craw.
Yeah bro, I'm definitely going to get cannibalized because I don't eat meat. That makes so much sense. You weak little bitch. -
2018-03-06 at 1:41 AM UTC in We have a moral obligation to stop eating meat
Originally posted by infinityshock are you fucking high? the entirety of your response is borderline gibberish…and little to no relation to anything im trying to say.
Sorry, I'll try to use smaller words to help you understand next time.yes, there are significant differences in that there are significant differences between an airplane and a circus cannon. after all, people use both of them to achieve air travel. youre comparing apples to handgrenades.
OK, so you think genetic engineering is categorically bad. Would you like to make the case here, or are you just planning to shout it loudly and repeatedly?the inherent problem is removing genetic material from and animal or plant or even a microbe and inserting it into an organism not even in the same kingdom. there has been little to no study on the effects of this so you know absolutely nothing on the topic.
Except like 40 years of genetic engineering and extensive testing which goes into any GM product.soy is shit protein because of its quality in relation to animal protein. being GM makes it even more so.
Yeah, except that soy protein isolate has a bout 3 times as much protein by weight than lean beef. Also a higher protein to calorie ratio too.you go be a good little herbivore and us carnivores will smile and wave at you while you fatten up until it youre all nice and juicy…ready to be fed upon.
Lol, you are one cringe ass bitch -
2018-03-04 at 7:16 PM UTC in We have a moral obligation to stop eating meat
Originally posted by Speedy Parker You failing to comprehend does not equal me being wrong.
You're avoiding the point now that you realize you're wrong.
Originally posted by infinityshock i didnt say anything about babies…youre the idiot that did.
It's called an analogy you dumbshit.youre also delusional to think that a vegetarian diet is nutritionally sufficient.
You're simply wrong, it's a subject that's been extensively and there is absolutely no dietary requirement that can't be met without meat consumption. If you disagree, try telling me which nutrient is absent. Go on.the human physiology has evolved for millions of years to consume an omnivore diet and youre deluded enough to think you can magically change that.
Human physiology has evolved for millions of years never moving faster than 30 miles per hour, but somehow we've managed to survive trains, planes, and automobiles. The fact that something doesn't have an evolutionary precedent doesn't mean it's somehow impossible to integrate into a modern lifestyle. The very fact that evolution happens demonstrates that things without evolutionary precedent can be successful survival strategies.go look up some of the archeological studies done on humans that had diets exclusively plant-based due to not having access to animals and see what ill-health they were in. the same goes for modern humans…theyre not designed to eat an exclusively plant-based diet.
Yeah, go look up what the diets of non-voluntary vegan historical societies, then look up what's considered a healthy vegan diet today. Tell me how similar those things look. Also humans weren't "designed" for anything.most importantly, the morals that you claim to possess, as well as those of PITA, are exclusive to yourselves and you may cordially stuff them into your asshole at the end of a bulldozer.
you dont see anyone consuming animals uncooked while still alive, either, retard. except for maybe that nutso nigger who was eating that homeless guy on live TV…but totally not the point.
WTF, are you unable to read or something? Where the fuck did I say anything about eating animals live and uncooked? You're one dumb nigger -
2018-03-23 at 6:19 AM UTC in The Retardest Thread: Fashionably Late Edition.
-
2018-03-23 at 6:25 AM UTC in The Retardest Thread: Fashionably Late Edition.I think fuck you
-
2018-03-21 at 3:01 PM UTC in I'm the cause of the two best banners on the site
-
2018-03-22 at 1:34 AM UTC in We have a moral obligation to stop eating meat
-
2018-03-22 at 2:43 AM UTC in The Retardest Thread: Fashionably Late Edition.
-
2018-03-22 at 1:30 AM UTC in We have a moral obligation to stop eating meatGuys, there's no rule against name calling but if your post is 100% insults and 0% discussion of the thread's topic then please take it elsewhere.
-
2018-02-22 at 9:09 AM UTC in We have a moral obligation to stop eating meat
Originally posted by A College Professor Just cause the MORALLY SUPERIOR BEINGs haven't keeled over and are able to subsist on kelp and worm-meal doesn't mean they are doing their body any favors.
So do you have any particular idea what, exactly, the dietary issue with vegetarianism is or is "no meat no good" the limit of your critique here?I believe the plants and animals are on this planet for my sustenance and enjoyment
It's nice you believe that and all, but that doesn't really say anything about it being true.Giving up meat is unnatural , it would be like an able-bodied person resigning themselves to life in a wheelchair cause they are lazy/ don't want to have to be buying shoes all the time ( sewn by little kids in asia in nasty factories! ). Unhealthy and silly!
So it's true that voluntary vegetarianism isn't really something we find in nature very often. Neither is your car or your phone, your clothes or your ability to read, or most of your diet. The fact that something isn't natural is stupid and hypocritical of anything using a computer to communicate with people.
On the topic of being unhealthy and silly, you're just wrong there.