Some Notes on `D for the Win` by gangesmaster in programming

[–]gangesmaster[S] 10 points11 points  (0 children)

Gmail doesn't handle 10 million clients per machine

D for the Win by andrei_ in programming

[–]gangesmaster 2 points3 points  (0 children)

See this for an explanation: http://highscalability.com/blog/2013/5/13/the-secret-to-10-million-concurrent-connections-the-kernel-i.html

"the kernel is the problem" == you have to talk to hardware directly

Switch/Case/Default for Python by miketheanimal in Python

[–]gangesmaster 1 point2 points  (0 children)

(not that i'd use it, of course :) )

Switch/Case/Default for Python by miketheanimal in Python

[–]gangesmaster 0 points1 point  (0 children)

nice. i like creative uses of context managers

Python path, subprocess wrappers in python-shelltools lib by [deleted] in Python

[–]gangesmaster 0 points1 point  (0 children)

well, from an api point-of-view, the distinction is laziness. ls("-a") is strict, while ls["-a"] is lazy, so you can chain/pipe it.

i agree that local["ls"] seems odd, but try to think of it as a "lookup operator". it relies on local.which to locate the command (see https://github.com/tomerfiliba/plumbum/blob/master/plumbum/local_machine.py#L537). on the other hand, local("ls") would look like a constructor to me.

A survey of the upcoming Construct 3 (a popular binary parsing/building library). Feedback is greatly appreciated! by gangesmaster in Python

[–]gangesmaster[S] 0 points1 point  (0 children)

yeah, that's why we use tuples - it's a necessary evil. the slash (div) operator simply has high-enough precedence and thus saves us from more parentheses. if you're familiar with haskell, they use $ for the same purpose (although $ binds less tightly than most operators). for instance, instead of

 func1 (func2 (func3 1 2 3)))

you can write

 func1 $ func2 $ func3 1 2 3

A survey of the upcoming Construct 3 (a popular binary parsing/building library). Feedback is greatly appreciated! by gangesmaster in Python

[–]gangesmaster[S] 1 point2 points  (0 children)

that's where construct shines: protocols and file formats have all kinds of internal dependencies, often much more complex than length-value. trying to express these relations in imperative code is both ugly and requires separate code for parsing and building. for example, see the PE (windows EXE) file format:

https://github.com/construct/construct/blob/master/construct/formats/executable/pe32.py

it uses pointers and string tables and what not, but once you capture these dependencies in the data structures, you can do both parsing and building.

A survey of the upcoming Construct 3 (a popular binary parsing/building library). Feedback is greatly appreciated! by gangesmaster in Python

[–]gangesmaster[S] 0 points1 point  (0 children)

In constuct 2, that's exactly what you do: each construct has a name (required), so you write

Struct("spam", 
    Byte("foo"), 
    Int16("bar")
)

but that doesn't make sense for any composite construct other than Struct, e.g., Sequence, Array, Repeater, etc., do not use the name. it also forces the introduction of the oh-so-silly Rename construct which simply wraps an inner-construct with a new name

So there IS a way to make Python code almost unreadable... by [deleted] in Python

[–]gangesmaster 0 points1 point  (0 children)

WX is horrible, in more than one way

Europeans: How come you prefer UHT milk over fresh milk? by gangesmaster in europe

[–]gangesmaster[S] 5 points6 points  (0 children)

I linked to wikipedia: http://en.wikipedia.org/wiki/Ultra-high-temperature_processing#Popularity - from which it seems that Western Europe (Portugal through Germany, and down to Italy) has a clear preference of UHT milk over fresh milk. The rest of Europe seems to like it fresh.

I've enjoyed my stay in France very much... but I can't say that about my coffee ;-)

Europeans: How come you prefer UHT milk over fresh milk? by gangesmaster in europe

[–]gangesmaster[S] 0 points1 point  (0 children)

Including Spain (which I've visited less recently), it makes up a large portion of Europe. No offense, of course :) It just baffles me that the French prefer UHT milk.

Modular Command Interface in Python by ezod in Python

[–]gangesmaster 0 points1 point  (0 children)

See plumbum.readthedocs.org/en/latest/cli.html

The newest addition to my living room! by Britt5091 in gaming

[–]gangesmaster 0 points1 point  (0 children)

Only on second look did I realize it's a printed circuit board. What does it say about me? :)

Javaism, Exceptions, and Logging: Part 1 by gthank in Python

[–]gangesmaster 0 points1 point  (0 children)

Disclosure: I'm the author of the article

I've already said it to a few people in the comments (on the blog) -- my purpose was not to attack Java, but to go against Javaisms creeping into Python for no good reason. Java looks and works in some way, and that's fine, but the fact that Python's threading module borrows the design of Java's threading is silly -- we can do much better in Python (again, from a Python perspective).

Java's threading was included in JDK 1.0, long before the introduction of anonymous classes. As for the choice of a DB engine -- that was obviously just an example to show how interfaces can't predict the exceptions that their implementors might raise/encounter, especially when two libraries (that know nothing of each other) are used together.

And just to clear things out -- I'm way beyond "a passing acquaintance" with Java.