Live data from Hacker News

5 Years of Bad Ideas -- Python tips, tricks, and chicanery

scribd.com

31–40 of 45 posts

Re: 5 Years of Bad Ideas -- Python tips, tricks, and chicanery

#31
post #30

Oh man, there is so much black magic in those slides. I hope to high heaven that as few people as possible read that. Especially not any future employers. Judging by the number of projects I have seen recently that are predicated on defining new keywords and recognizing them through magic decorators, it may be too late.

This is one of the reasons I love Go: simple, clean, concise, expressive, and completely free of dark magic. Code does what it says, and says what it does. You don't get to feel so clever doing magic tricks, but you gain a lot of time by not having decipher and debug such magic tricks.

I believe in a balance, too little magic, and you're working with one hand tied behind your back, too much magic and you're working with blindfolds.

Re: 5 Years of Bad Ideas -- Python tips, tricks, and chicanery

#32
post #31
post #30

Earlier quoted context omitted.

This is one of the reasons I love Go: simple, clean, concise, expressive, and completely free of dark magic. Code does what it says, and says what it does. You don't get to feel so clever doing magic tricks, but you gain a lot of time by not having decipher and debug such magic tricks.

I believe in a balance, too little magic, and you're working with one hand tied behind your back, too much magic and you're working with blindfolds.

Seriously, try Go for a while, it wont take long before you feel that you have three hands, and more importantly, an extra third eye.

Re: 5 Years of Bad Ideas -- Python tips, tricks, and chicanery

#33
post #26

Earlier quoted context omitted.

> I'm sad to say I really don't understand most of whats going on in this code.. Don't be:) Most of the dark voodoo there is not used(macros, implicit self), some of it is used only by toolmakers(finding request, changing traceback messages, import hooks), and then a small part is used here and there by regular applications(monkey patching; "names of variables" sounds useful but it won't work with shared pool. `a = 1…

> but it won't work with shared pool. `a = 10; b = 10; show_names(a)` will show both "a" and "b") That will actually show nothing because strings are not tracked by the cyclic garbage collector because they can never be part of cycles.

My bad. I was talking about this alternate implementation:

https://gist.github.com/2688055

Re: 5 Years of Bad Ideas -- Python tips, tricks, and chicanery

#34
post #18

This presentation is by Armin Ronacher, the author (amongst many other things) of Flask, Werkzeug and Jinja2. If people find this presentation interesting he catalogues and provides slides (and recordings where appropriate) of all his previous presentations: http://lucumr.pocoo.org/talks/ For those who prefer straight PDF over Scribd, Armin has a PDF provided for this presentation[1]. There's also a video but it seem…

i started using flask this past winter. i'm enjoying it as a lightweight framework. armin's got some good code and the reason i posted this link is that the topics and ideas are real and presently simply, useful (in some situations), and great to understand.

Re: 5 Years of Bad Ideas -- Python tips, tricks, and chicanery

#35
post #32
post #31

Earlier quoted context omitted.

I believe in a balance, too little magic, and you're working with one hand tied behind your back, too much magic and you're working with blindfolds.

Seriously, try Go for a while, it wont take long before you feel that you have three hands, and more importantly, an extra third eye.

Can you give an example in Go of how you'd solve the same problem as any of the python solutions?

Re: 5 Years of Bad Ideas -- Python tips, tricks, and chicanery

#37
post #13

Earlier quoted context omitted.

The guy who founded Scridb is here as well as tons of googlers.

As well as a ton of AdBlock users who'd prefer discussion of the presentation's content, and have no idea about the obtrusive adverts others mention ...

So what are they doing following this particular sub-thread and giving other people condescending advice?

Why aren't they busy reading other sub-threads where the presentation's content is discussed?

Re: 5 Years of Bad Ideas -- Python tips, tricks, and chicanery

#38
post #32
post #31

Earlier quoted context omitted.

I believe in a balance, too little magic, and you're working with one hand tied behind your back, too much magic and you're working with blindfolds.

Seriously, try Go for a while, it wont take long before you feel that you have three hands, and more importantly, an extra third eye.

I use Go and I don't see any particular expressivity or ability to code easier/faster, compared to, say Python.

The benefits are: type checking (if you need it), more speed (but not as much as advertised), and easy concurrency (if you need it).

I think one of the main "marketing" points of Go, in a grassroots way, is that some people coming from Python/Ruby/js etc, that have never (or only very lghtly) used C/C++ before, feel suddenly like they are using a "hard, grown up's language", what with pointers and everything. It's mostly an illusion, though.

Re: 5 Years of Bad Ideas -- Python tips, tricks, and chicanery

#39

Oh man, there is so much black magic in those slides. I hope to high heaven that as few people as possible read that. Especially not any future employers. Judging by the number of projects I have seen recently that are predicated on defining new keywords and recognizing them through magic decorators, it may be too late.

here's where i disagree with you, and here's why.

there comes times - hopefully rarely - where tricks like metaclasses and monkey patching actually REDUCE overall code complexity, if done right and in a limited way. it takes a lot of experience, education, and skill to do this, but when you see it done right it greatly reduces overall code complexity by isolating the "odd" bits into small, confined spaces, and this can lead to more readable code overall. the other day a link was posted here on HN about metaclasses in python, and dpkt was one of the examples (see the _metapacket class). i think that's a good example of the above: the scary, hard to grok stuff is isolated, and overall the code becomes more readable for it. i've seen - and written - code that could benefit from these things, and it's less maintainable than code with them used appropriately.

also, i think it's great if people read this and learn. i want more talented programmers on my team, people who know how to do these things, when to do them (e.g. limited), and where to do them. i've seen the opposite, and it's not pretty.

that said i'm unqualified to use the "bad ideas" in this presentation appropriately, and so i wont. one facet of wisdom is knowing your limits.

Re: 5 Years of Bad Ideas -- Python tips, tricks, and chicanery

#40
post #21

Earlier quoted context omitted.

What? You killed Chrome because of what? What is a custom dialog? How is a "custom dialog" going to create a vulnerability?

There is a long history of such dialogs being used to exploit browsers and cause the execution of arbitrary code. For instance, such a dialog may be used to generate a true user click event, which the browser may then treat differently than an event that can be faked by Javascript. This entices malware developers to create dialogs in which you'll click on something, they don't really care what, they just need an auth…

Oh the plight of a Windows user.

I know what you're talking about with click jacking. The implication that a "true click" is any more likely to allow a JavaScript exploit to escape the browser sandbox is complete and utter bullshit. If you can give me one example, I won't scowl at the fact that 6 other people downvoted me without saying why.

Post reply on HN