User Controls
Posts That Were Thanked by Sophie
-
2017-01-11 at 10 PM UTC in The retarded thread: Fuck, §m£ÂgØL made one first editionI saw on one media site over here they were saying that 4chan's evidence for it being a troll is "tenuous" LOL. Like their evidence for it existing, or really any evidence about anything about Trump, is oh so solid
-
2017-01-11 at 7:59 PM UTC in trans stuff is gayHuh, seems like me telling him it's not his fault finally affected him
-
2017-01-11 at 2:28 PM UTC in why to save nudes
Post last edited by omg at 2017-01-19T22:56:55.449393+00:00 -
2017-01-11 at 2:14 PM UTC in The retarded thread: Fuck, §m£ÂgØL made one first edition
Originally posted by aldra
cia rekt by /pol/
I lol'd last night when I first read that story cos it was so blatantly fake to anyone reading it with half a brain/not brainwashed by gullible lefties. America has a big problem on it's hands, they're guna do anything in their power to stop a democratically elected man taking office, or at least staying in office. I hope you guys rise up and start a civil war when this shit happens -
2017-01-11 at 1:47 PM UTC in I need the totse army
Originally posted by infinityshock pics or fat faggot living in his mommy's basement
Shit, you've really put me in a corner here... pic would prove the latter and without pics the latter is assumed. I don't know how to respond so I'll just post a pic anyway.
Am I pretty? Tell me I'm pretty. Lie to me if you have to. -
2017-01-11 at 3:43 AM UTC in The retarded thread: Fuck, §m£ÂgØL made one first edition
-
2017-01-10 at 7:35 PM UTC in i want to fuck this girl so badly
-
2017-01-10 at 3:17 AM UTC in making a foruma captcha that always makes you type 'death to israel'
-
2017-01-10 at 2:17 AM UTC in I need the totse army
Originally posted by Clutch I agree but in my personal opinion Islam is the greater evil when compared to the FBI, CIA, NSA
shows how much you know about hajis and the assorted betabet soup agencies.
or more accurately: dont know. -
2017-01-10 at 1:40 AM UTC in I need the totse army
Originally posted by Sophie Only thing you fought for is for the expansion of state power which is the antithesis of freedom.
Thank you sophie.. people like this guy clutch join the military to feel big and tough. Then when they get out they brag about how big and bad they were defending our "freedom". -
2017-01-09 at 6:32 PM UTC in This is deep
-
2017-01-09 at 3:51 PM UTC in The retarded thread: Fuck, §m£ÂgØL made one first edition
Originally posted by cerakote yeah they are but what does it matter
the fact that you are sitting here with your finger up your ass shows how little sense our existence makes but unless you believe in a higher power its staying that way
you can create your own meanings if it makes you more satisfied with life. doesn't make it correct, but nobody has to be correct all the time. religions are prepackaged lifestyles designed to cope with the meaninglessness of existence, but when people take them as fact we have islam and wars. it has its own consequences. -
2017-01-09 at 7:42 AM UTC in Why does Python have Decorators instead of multi-statement Lambas?A common use case is when you have some kind of behavior you want to apply to several functions but where directly invoking some new function doesn't make sense. An example might be type sniffing, you could do this:
def add(a, b):
assert type(a) == int
assert tybe(b) == int
return a + b
def subtract(a, b):
assert type(a) == int
assert tybe(b) == int
return a - b
This works but we'd like to lift the type check out of each, so we could refactor as:
def check_are_ints(*args):
for arg in args:
assert type(arg) == int
def add(a, b):
check_are_ints(a, b)
return a + b
def subtract(a, b):
check_are_ints(a, b)
return a - b
And this is better but on some level we know "check my argument are integers" isn't really the business logic in addition or subtraction, and further we think about this check as being a property of the function instead of part of it's logic. Using decorators we can:
def args_are_type(fn, arg_type=int):
def new_func(*args):
for arg in args:
assert type(arg) == arg_type
return fn(*args)
return new_func
@args_are_type(int)
def add(a, b):
check_are_ints(a, b)
return a + b
@args_are_type(int)
def subtract(a, b):
return a - b
This lets us parameterize the type we're checking against and it lifts the check out of the body of the function.
Another common use case is if you want to "register" a function in some way, for example:
registered_funcs = []
def register(fn):
registered_funcs.append(fn)
return fn
@register
def foo_bar():
...
# registered_funcs == [foo_bar]
And another example that's actually pretty common to see in the wild:
def memoize(fn):
memo = {}
def new_fn(*args):
arg_hash = sum([hash(arg) for arg in args])
if arg_hash not in memo:
memo[arg_hash] = fn(*args)
return memo[arg_hash]
@memoize
def add(a, b):
print a, b
return a + b
add(1,1)
add(1,1)
add(1,2)
# outputs:
# 1 1
# 1 2
Again, all things you could do before but being able to "wrap" functions like this allows you to program in a more generic way and can help separate facts "about" functions (this function is memoized, this function checks types) from their core logic. -
2017-01-09 at 6:23 AM UTC in Why does Python have Decorators instead of multi-statement Lambas?It's not so much an "instead of" relationship. Decorators don't really do what you'd want multi-line lambdas to do nor vice versa. Really both features (and all lambdas, per the python idea of a lambda) don't express anything that couldn't be expressed in the language otherwise, they're just nice syntactic sugar.
To answer the questions separately, decorators are in the language because Guido liked annotations in Java, decorators are more powerful than annotations but use the same syntax and provide a superset of the annotation functionality. Multi-line lambdas are not in the language because Guido has a wierd dislike of functional programming (same reason map/enhancement/reduce have been relegated to functools), also he's said it will complicate the parser which is true but no one's really satisfied by that because nested list comprehensions are a lot more complexity in the parser (and for the reader) and no one has said that needs to be cut from the language.
To go into a little more depth: The decorator syntax is just a way of giving a name to the output of a higher order functions, functions that take a function and return a function, we see the equivalence in your second example. Higher order functions don't exist in languages like C and Java, which is where python inherits a lot of its syntax. In these languages naming functions is kind of special, `int foo(int a) { return a*2; }` creates the name `foo` forever as an immutable declaration entirely different from a variable named foo. There is no way in C to say `bar = foo` down the line (yes function pointers exist but that's different). That is important for compiler optimizations like function inlining and metadata discarding (under optimized compilation the string "foo" doesn't exist anywhere in a program defining a function foo, all references are replaced by an address rather than the function's name). This means defining a function called bar in python by doing `bar = decorate(foo)` looks pretty strange to a lot of programmers. Arguably (I'd agree) it hurts readability because when you see a top-level `def` you're like "ok, cool, this package exports this function" but when you see `bar = decorate(foo)` you think "what is this? constant? global? decorated function?" plus you're still exporting the undecorated `foo` as part of the package. The decorator syntax fixes this by keeping the `def ...` syntax for defining decorated functions and prevents the export of the undecorated function, in fact it's impossible to call the undecorated function that way.
Actually I see now why lambdas get involved, because actually this is kind of like a lambda. Lambdas are un-named functions and the pre-decorated function using the decorator syntax is also unnamed, so yeah, in terms of removing the undesirable creation of an undecorated function under some accessible name both multi-line lambdas and the decorator syntax could accomplish the same goal. The added bonus of decorators is that they read better. They're not as flexible as muti-line lambdas because they're not expressions (you can't assign them to a name with `=` or pass them as an argument) but as someone who would like to see multi-line lambdas added to the language, I don't think they would displace the need for (or at least the utility of) the decorator syntax.
Originally posted by SBTlauien I never learned lambdas but I started. It didn't seem like something needed. Correct my if I'm wrong.
"lambda" in the computer science sense is a very important idea, arguably the most powerful single idea in computation. "lambdas" in python are lambdas in the CS sense, but so are functions. The way we use the lambda keyword in python is really kind of a shorthand. Still a useful tool, you see them pretty often in code and they're just a handy too so I'd say it's something worth learning (honestly they're not very complex once you understand that functions are objects) but there's never been a program where you strictly needed to use the lambda keyword. -
2017-01-09 at 4:19 AM UTC in i want to fuck this girl so badly
Originally posted by Malice You are pathetic. Well, I suppose you are still relatively young…
you're on too talk about being pathetic, you're a virgin. -
2017-01-09 at 3:56 AM UTC in I need the totse armyyou picked up on your/you're but not 'anti-semantic'?
you need an autism tune-up -
2017-01-09 at 3:11 AM UTC in Its the 0.01% of non functional/criminal drug addicts that give drug use a bad name.Yea well we gotta move as slow as the slowest members of society. It sucks but it's how it is right now.
Until the 20th and we make America great again -
2017-01-09 at 12:41 AM UTC in living terrarium
Originally posted by hydromorphone da fuk are you on about?
On topic: I thought about doing this a while ago (save without the shrooms). I think it's a pretty cool idea, but I imagine it'd take a bit of experimenting to get right since not everything is going to work out as swell and hunky dory as one would fist think it should, especially considering there are so many different things going on at once. Another cool idea is one where people do hydroponics on floating forms where the fish help with the fertilization of the plants.
He's copying shit from the forum we wouldn't troll for him. He's pissed off at us and this is his revenge.
Ever since I saw like a little garden within a lightbulb I've always wanted to do that, they look cool as fuck. Or bonsai a cannabis plant, that'd be a nice little project too.
-
2017-01-09 at 12:17 AM UTC in bengal catsNice copy pasta. Why do you expect us to troll for you if you can't even be original here
-
2017-01-08 at 11:09 PM UTC in Suicidemurder/suicide