Better HN
topnewbestaskshowjobs
Log inSign up

pixelmonkey

6,134 karma · joined Oct 5, 2007 (19y ago) · 831 submissions

Founder of PX Systems, which ships a daily developer tool to go from code to cloud cluster in seconds. More info @ https://px.app

Formerly the founding CTO of Parse.ly. Coding in: Python, JavaScript, Zig. Pleased to be a Pythonista and UNIX lover.

Parse.ly was acquired by Automattic (creators of WordPress.com) in February 2021; more here: https://www.techmeme.com/210208/p12#a210208p12

My essays & technical blog: https://amontalenti.com

My AngelList profile: https://angel.co/p/amontalenti

My occasional tweets: https://twitter.com/amontalenti

Submissions

comment 10y ago · link · parent

Wow. I still use VMWare Workstation all the time. I guess it's time to switch to VirtualBox and Windows 10 for my occasional MS Office needs.

If this isn't a sign of the decline of enterprise desktop software, nothing is!

comment 10y ago · link · parent

I agree. I opened PR #19 to address this:

https://github.com/amontalenti/elements-of-python-style/pull...

Would love to hear what you think of the changes.

comment 10y ago · link · parent

Thanks -- we are actually discussing this possible change in a Pull Request here: https://github.com/amontalenti/elements-of-python-style/pull...

comment 10y ago · link · parent

It's a fair point, but the style guide is meant to be illustrative.

The former example is indented the way longer lines might very well be e.g. if your filter clause were a 2-part bool, you might not be able to fit it in a one-liner. The indentation also clarifies the difference between it and the imperative example above it.

The latter example is a rewrite of code written with 2 nested if statements, so the indentation serves to show that now the two nested statements were incorporated into the bool evaluation. If I made it a one-liner, someone might make the argument that the nested version is "more readable", but as written all you can say is that the single-if version is "less nested", which is the point I was trying to get across.

comment 10y ago · link · parent

I'm "this guy" who "got a bunch of things wrong" :)

Style guides are opinionated, and not everyone will agree. I intentionally made the style guide part of a Github repository so I could consider feedback from the community, and I've already incoporated plenty. As I mention below in the thread, I think you have a good point about "args" vs "cards" for your shuffle example.

Re: "The preferred place to break around a binary operator is after the operator, not before it", I think you mis-read this PEP8 suggestion. A binary operator is something like "and" or "+", not the "for" keyword inside a listcomp.

Re: your other disagreements, they amount to style choices of their own. When a style guide picks between two ways of doing things, there will inevitably be detractors, and I am OK with that.

comment 10y ago · link · parent

I'd gladly accept a PR on the issue raised re: "args" vs "cards" for the shuffle function. When I wrote the guideline on using the names "args" and "kwargs", I was thinking more about cases where you have to proxy both, e.g.

    class SomeClass(SomeOtherClass):
        def __init__(self, *args, **kwargs):
            # some logic
            super(SomeClass, self).__init__(*args, **kwargs)

comment 10y ago · link · parent

Ubuntu before Ubuntu! And my first "workaday" Linux desktop distro. Same here, that was how I came to know Ian Murdock indirectly.

comment 10y ago · link · parent

I was once asked to help a friend debug his server. Its mysql state was not loading properly, so I wrote an rsync line to back up all the mysql data as a safety step before debugging. A few seconds later, I realized I put a forward slash and a space in the wrong place and had managed to delete the entire directory.

I felt like such an idiot. At least I haven't messed up an rsync command since!

comment 10y ago · link · parent

What's more, we have good Python style, too :)

https://news.ycombinator.com/item?id=10831045

580.

The Elements of Python Style(github.com ↗)

147 points · by pixelmonkey · 10y ago · 61 comments

comment 10y ago · link · parent

Parse.ly - http://parse.ly - Fully Remote - Full-Time

We are hiring a software engineer to work on our real-time analytics dashboard. Pythonistas and JavaScript hackers especially desired.

On the company: We've built a real-time content measurement layer for the entire web.

Our analytics platform helps digital storytellers at some of the web's best sites, such as Arstechnica, New Yorker, The Atlantic, The Next Web, and many more. In total, our analytics backend system needs to handle over 50 billion monthly events from over 475 million monthly unique visitors.

Our entire stack is in Python and JavaScript, and our team has innovated in areas related to real-time analytics, building some of the best open source tools for working with modern stream processing technologies. Our UX/design team has also built one of the best-looking dashboards on the planet, using AngularJS and d3.js. You can see some screenshots at http://parse.ly/tour.

Our distributed team is best-in-class and we happily skip commutes by working out of our ergonomic home offices. Here's a photograph of mine running two full-screen Parse.ly dashboards on my monitors: https://flic.kr/p/v1NZ73

We are currently looking for software engineers to help us build the best real-time analytics dashboard the world has ever seen. The only requirement is some experience in Python/JavaScript. Bonus points for an interest in information visualization, Edward Tufte, and d3.js.

To see an example of how we work, check out the blog post, "Whatever It Takes": http://blog.parsely.com/post/46

Apply now by sending a CV/website, github link (if available), and 1 paragraph intro to work@parsely.com. Let us know what part of the position interests you, or point us toward an interesting project or piece of code you wrote. Also, mention the HN Who's Hiring thread.

comment 10y ago · link · parent

I think we learned a long time ago that though codegen is one path to speedy code, it is not the only path.

The thriftpy module dynamically generates a Python module that is based on parsing the thrift schema. That happens once: at module import time. After that, Python has cached the module in sys.modules and it doesn't need to be evaluated again during the program's runtime.

The module contains efficient Python classes that are Python bytecode just the same way "compiled" classes would be. But, thriftpy has Cython implementation of Thrift protocols and transports that compile down to C, not Python bytecode. Thus, the thriftpy impl's are not only more dynamic and less cumbersome than the codegen alternative, but they are also faster.

In the Python community, we prefer to take other approaches to achieve execution speed.

Dynamically generating a Python module is not "metaprogramming". It is not black magic. You can generate a module yourself simply by instantiating a Python module type. Hooking the import statement is an officially supported part of the language, and done by many libraries.

This may all seem very worrying to a C++ or Java programmer, but in the Python community we have been doing dynamism with execution speed for about 10 years now, and we haven't regretted any of the results!

comment 10y ago · link · parent

I suspect it comes down to the details of the serialization format.

I know that Thrift and Protobuf were developed / publicly released around the same time (~2008). They both have serialization and RPC approaches. They both have an IDL format and a compiler for codegen in static languages like C++ and Java.

Thrift was adopted by the Apache O/SS community and so it can be found in some Apache projects, e.g. Thrift is used as an interop format in Apache Storm and as a serialization backend supported by Apache Parquet.

Thrift has had a lot of client libraries for different languages come out over the years, so it tends to work everywhere.

IIRC, CapNProto and FlatBuffers were each built as fresh takes on protobuf. So I imagine they are similar, with IDLs and serialization approaches of their own. I took a quick look at CapNProto's Python module documentation and it looks very similar to thriftpy in philosophy, but I don't know its intricate details as I haven't used it.

This guide to Thrift covers all the important details of its schema approach and is meant as a cross-language guide. It should be the official docs, but alas, it's not!

https://diwakergupta.github.io/thrift-missing-guide/

comment 10y ago · link · parent

Thrift is a very similar system for message serialization to Protobuf.

The thriftpy project implements a pure Python parser for thrift files that dynamically generates Python modules without a build/codegen step. Also has Py2, Py3, and PyPy support.

Awesome library for this sort of thing. Includes a Cython impl of Thrift parsing/serialization, too:

https://github.com/eleme/thriftpy

comment 10y ago · link · parent

An oldie but goodie. Beazley did a follow-up to this at PyCon 2014, a 3-hour tutorial on generators. Very much worth a watch! It's called "Generators: The Final Frontier".

https://www.youtube.com/watch?v=5-qadlG7tWo

comment 11y ago · link · parent

It's cool that PyCharm added support for this -- the point of the typing module and the type hinting PEP is for IDEs to adopt it for linting purposes.

For those of you using vim, emacs, and the standard UNIX editing toolchain, the mypy linter provides command-line support. This blog post from April 2015 describes the first version of mypy that includes support for the official typing library.

http://mypy-lang.blogspot.co.uk/2015/04/mypy-02-released.htm...

comment 11y ago · link · parent

I recently watched Guy Steele's "Growing a Language" talk. It's very much related to jmoiron's post here, and is worth a watch despite its age:

https://www.youtube.com/watch?v=_ahvzDzKdB0

Steele's commentary on "Worse is Better" seems to me to be a better representation of the original essay than the one expressed here about Go. Steele says:

"The gist of ['Worse is Better'] is that the best way to get a language used by many persons is not to design and build 'The Right Thing,' because that will take too long. In a race, a small language with warts will beat a well designed language because users will not wait for the right thing; they will use the language that is quick and cheap, and put up with the warts. Once a small language fills a niche, it is hard to take its place."

In other words, the lesson of 'Worse is Better' is that getting a 'good enough' thing to market, and benefiting from the network effects of its widespread use, will always beat getting the 'the really good' thing to market in the same category, because the cost of delay is the loss of (community) network effects. The illustrative example here is UNIX and C, but it can be easily cross-applied to more recent projects.

From that vantage point, Go isn't a good example of 'Worse is Better'. It occupies the same niche as C, but was delivered nearly 4 decades later. It seems to be a "second edition of C" designed with very explicit goals of correcting specific deficiencies of C as a systems programming language, but without the scope creep that characterizes many "second systems".

Other languages -- like Python and Scala -- occupy completely different niches and have already achieved similar scale of network effects.

The rest of Guy Steele's talk is worth watching, because his high-level point is that the languages that win aren't the simpler ones, or the ones with the simplest/best design, but instead are the "growable" ones that get to market.

For example, from Steele's vantage point, the success of a programming ecosystem like Python's would be evaluated as follows: it isn't that it has the right level of simplicity/dynamism, or an appropriate programming paradigm. That Python made good decisions there helps, but they aren't the key ingredients. Instead, its success is that it shipped in 1991, evolved over time to keep up with programming trends, that it has an awesome 'import' statement, and that programmers feel they can 'grow' the language through libraries (e.g. Django for web development, Pandas for data analysis) without waiting on the slow core language or stdlib evolutionary process.

comment 11y ago · link · parent

I recently watched Guy Steele's "Growing a Language" talk. It's very much related to jmoiron's post here, and is worth a watch despite its age:

https://www.youtube.com/watch?v=_ahvzDzKdB0

Steele's commentary on "Worse is Better" seems to me to be a better representation of the original essay than the one expressed here about Go. Steele says:

"The gist of ['Worse is Better'] is that the best way to get a language used by many persons is not to design and build 'The Right Thing,' because that will take too long. In a race, a small language with warts will beat a well designed language because users will not wait for the right thing; they will use the language that is quick and cheap, and put up with the warts. Once a small language fills a niche, it is hard to take its place."

In other words, the lesson of 'Worse is Better' is that getting a 'good enough' thing to market, and benefiting from the network effects of its widespread use, will always beat getting the 'the really good' thing to market in the same category, because the cost of delay is the loss of (community) network effects. The illustrative example here is UNIX and C, but it can be easily cross-applied to more recent projects.

From that vantage point, Go isn't a good example of 'Worse is Better'. It occupies the same niche as C, but was delivered nearly 4 decades later. It seems to be a "second edition of C" designed with very explicit goals of correcting specific deficiencies of C as a systems programming language, but without the scope creep that characterizes many "second systems".

Other languages -- like Python and Scala -- occupy completely different niches and have already achieved similar scale of network effects.

The rest of Guy Steele's talk is worth watching, because his high-level point is that the languages that win aren't the simpler ones, or the ones with the simplest/best design, but instead are the "growable" ones that get to market. For example, from Steele's vantage point, the success of a programming ecosystem like Python's would be evaluated as follows: it isn't that it has the right level of simplicity/dynamism, or an appropriate programming paradigm. That Python made good decisions there helps, but they aren't the key ingredients. Instead, its success is that it shipped in 1991, evolved over time to keep up with programming trends, that it has an awesome 'import' statement, and that programmers feel they can 'grow' the language through libraries (e.g. Django for web development, Pandas for data analysis) without waiting on the slow core language or stdlib evolutionary process.

comment 11y ago · link · parent

Parse.ly - http://parse.ly - Fully Remote - Full-Time

Parse.ly has built a real-time content measurement layer for the entire web.

Parse.ly's analytics platform helps digital storytellers at some of the web's best sites, such as Arstechnica, New Yorker, The Atlantic, The Next Web, and many more. In total, our analytics backend system needs to handle over 30 billion monthly events from over 450 million monthly unique visitors.

Our entire stack is in Python and JavaScript, and our team has innovated in areas related to real-time analytics.

Our UX/design team has also built one of the best-looking dashboards on the planet, using AngularJS and d3.js. You can see some screenshots at http://parse.ly/tour.

Our distributed team is best-in-class and we happily skip commutes by working out of our ergonomic home offices. Here's a photograph of mine running two full-screen Parse.ly dashboards on my monitors: https://flic.kr/p/v1NZ73

We are currently looking for UX / front-end / full-stack engineers to help us build the best real-time analytics dashboard the world has ever seen. The only requirement is some experience in Python and JavaScript, with an emphasis on JavaScript. Bonus points for an interest in information visualization, Edward Tufte, or d3.js.

Apply now by sending a CV/website, github/dribbble links (if available), and 1 paragraph intro to work@parsely.com. Let us know what part of the position interests you. Also, mention the HN Who's Hiring thread.

p.s. to see an example of how we work, check out the blog post, "Whatever It Takes": http://blog.parsely.com/post/46

comment 11y ago · link · parent

First, you definitely want to discuss this with your boss rather than just quitting. It sounds like you like the company you're working for, but you're just feeling the effects of burnout. Here are some questions for you:

1. how long have you been at the company?

2. what is different about the work you did this year vs the first year you worked at the company?

3. who at the company seems similarly burned out to you? have you tried talking to that peer about burnout and what the root causes might be (e.g. projects, technologies, pressure from business, etc.) before taking it to your boss?

4. do you think your boss is the kind of person who would welcome a frank discussion about this -- is he or she the kind of person that already talks about controlling for employee burnout and striving for work/life balance among staff on a regular basis?

comment 11y ago · link · parent

Really cool -- just got it working in about ~10 minutes on a fresh Atom install. Was able to verify that it works in a web browser session. Very cool, so far. Keep going!

comment 11y ago · link · parent

“If the office is going to become a collection of employees not working together, it essentially becomes no different than a coffee shop.”

The horror! You mean the office might degenerate into a quiet work environment where people focus on getting things done? How will these companies possibly recover? Especially while all the employees of their competitors are escaping their noisy, interruptive offices to get work done... at a nearby coffee shop!

What might happen if these offices started offering perks of the best coffee shops, like actually good coffee, fast wifi, and comfy chairs? How could they possibly survive the revolts from their staff, not to mention the decline in productivity?!

comment 11y ago · link · parent

htop is one of my favorite UNIX tools in existence!

Check out htop running my laptop while I had an "ssh-multi" tmux session opened up on an Apache Spark cluster, doing computation 32 cores x 25 nodes = 800 cluster cores! It's so fun to watch all of those cores light up green while doing a big batch job.

https://www.flickr.com/photos/amontalenti/21512617686/in/dat...

We are big fans of htop at Parse.ly. We install it on every one of our nodes.

comment 11y ago · link · parent

Parse.ly - http://parse.ly - Fully Remote - Full-Time

Parse.ly has built a real-time content measurement layer for the entire web.

Parse.ly's analytics platform helps digital storytellers at some of the web's best sites, such as Arstechnica, New Yorker, The Atlantic, The Next Web, and many more. In total, our analytics backend system needs to handle over 40 billion monthly events from over 550 million monthly unique visitors.

Our entire stack is in Python and JavaScript, and our team has innovated in areas related to real-time analytics, building some of the best open source tools for working with modern stream processing technologies. These include pykafka, pystorm, and streamparse.

Our UX/design team has also built one of the best-looking dashboards on the planet, using AngularJS and d3.js. You can see some screenshots at http://parse.ly/tour.

Our distributed team is best-in-class and we happily skip commutes by working out of our ergonomic home offices.

Here's a photograph of mine running two full-screen Parse.ly dashboards on my monitors: https://flic.kr/p/v1NZ73

We are currently looking for front-end engineers to help us build the best real-time analytics dashboard the world has ever seen. The requirements: programming background in Python and JavaScript, emphasis on JavaScript. Bonus points for an interest in information visualization and Edward Tufte. You can't be a frontend web coder only -- you need to be willing to be a flexible Python programmer, too.

This role will involve you rolling up your sleeves to debug queries generated by our Python data access layer or optimize middle-tier performance through caching with Redis. But it'll also have you applying advanced in-browser dataviz and UX techniques with d3.js and AngularJS, and thinking through the way to best satisfy customer demands around real-time content analytics data.

We are also hiring backend engineers to expand our data platform and make the world's most flexible and highest-performance real-time content analytics system. On this team, you'd be working with Python experts in using Storm, Kafka, Cassandra, Elasticsearch and Redis at scale.

Finally, we have an opening for a Python engineer particularly interested in automated testing of API servers, third-party JavaScript, and rich web/mobile applications via modern frameworks like Locust, WebDriver, PhantomJS, and Appium.

Apply to any of these roles now by sending a CV/website, github/dribbble links (if available), and 1 paragraph intro to work@parsely.com. Let us know what part of the position interests you. Also, mention the HN Who's Hiring thread.

p.s. to see an example of how we work, check out the blog post, "Whatever It Takes": http://blog.parsely.com/post/46

comment 11y ago · link · parent

Makes total sense, especially the part "Superchief is not an off-the-shelf-framework that anyone will be able to drop-in to fulfill their stream processing requirements".

So, essentially, Storm solved a more generic problem than you needed it to solve. Superchief is a narrower system that more closely aligns with your problem domain, and this let you not only simplify a little but also gain efficiency. Makes sense!

(p.s. the reason I ask is because I am deeply committed to the Apache Storm open source community, as one of the co-authors of streamparse and pystorm.)

comment 11y ago · link · parent

How much of your decision to replace Storm stemmed from "this would be a fun technical challenge" that you economically justified by cutting server costs? It's hard to tell from the blog post whether you view SuperChief as an "indictment" of running Storm at scale, or whether you just thought building your own stream processor would be a great way to learn new things and cut server costs at the same time.

comment 11y ago · link · parent

All very good suggestions, especially Goyo for distraction-free writing.

I personally enjoy vim-livedown:

https://github.com/shime/vim-livedown

It opens up a browser window with a rendered Markdown page, and live updates when a Markdown file changes. This lets you do "split screen text/preview" editing, which is wonderful.

I also enjoy the simplenote.vim plugin. Simplenote is the hosted note taking service run by the team at Automattic/Wordpress. It's not well known that it supports Markdown fully, and also has a way to one-click publish your Markdown posts. The vim plugin lets you edit all your Simplenotes inside vim itself! If you use Simplenote, this is a great plugin.

https://github.com/mrtazz/simplenote.vim

I also set up a bash alias like this:

    alias simplenote=vim -c "Simplenote -l"
which lets me type "simplenote" at the command line and get a vim editor that is open on my Simplenote account. Then I markdown away and can preview/publish from the web interface!

comment 11y ago · link · parent

I really enjoy using pyenv these days.

https://github.com/yyuu/pyenv

In that case, `pyenv install 3.5.0` and then `pyenv shell 3.5.0` or `pyenv global 3.5.0` to switch which Python gets used. With pyenv's virtualenv plugin, you can also get rid of the need to use virtualenvwrapper for managing dependencies.

comment 11y ago · link · parent

Parse.ly (http://parse.ly)

comment 11y ago · link · parent

I'm the co-founder/CTO of an analytics company that serves publishers. My company's data on Facebook vs Google referrals was cited in this NYT article, in fact.

We offer analytics with a similar business model to companies like MixPanel and NewRelic -- that is, not analytics for ad serving and buying, but for improving user experience, user engagement/loyalty, and informing content strategy. Like those companies, we charge money for these analytics -- because they are valuable to the site owners, are hard to calculate, and help them improve their sites over time.

I'll try to summarize what I see happening:

When I first entered this industry (~5 years ago) and launched our first JavaScript integration, the state of JS in the industry was poor. Ad tech companies embedded clunky iframes that would sometimes load entire web stacks in them. Loading a single publisher website was often like loading 10 websites in parallel in a single tab. Many of these ad tech vendors haven't upgraded, so this kind of stuff is still floating around.

I made a focused effort to make a slim JavaScript integration to collect the data we needed for useful reporting to the site owners, using as few bytes as possible. That meant writing all the JS code "from scratch" (no dependencies), forcing async-loading, and beaconing back the minimum needed data.

Over time, we've slimmed down our integration considerably as more engineers have come on-board and came up with ideas to make our JS have less and less impact on page load performance. We've kicked tires on various code minifiers to find the right one, refactored code to simplify it, etc. But my company is rare in this respect. Most vendors (many of them ad tech) simply don't care. Once they integrate their crappy code on the site, it's frozen forever, and they don't touch it.

As one small example of this, my company's analytics system collects data about pages via a backend web crawler that integrates the Schema.org JSON-LD web standard, the same standard that the search engines use. What does this mean? Rather than beaconing back ~50kb of article metadata on every page view of the article (which is what most page analytics vendors do, e.g. Adobe Omniture or Webtrends), we beacon back 1kb of event data on every page view, then crawl the other 50kb from our backend servers. In this way, we don't punish every user, over and over again, for the data we need to collect. This requires us to do a streaming join of these data sets on the backend, which is complicated. But it's complicated for us, the engineers building the analytics system, not for you, the typical web visitor. That's The Way It Should Be.

There is also a shady thing going on where many "data brokers" offer publishers a single JavaScript integration, which starts off slim. But as the publisher's data gets "sold" to other data brokers and ad exchanges, the JavaScript integration gets fatter, because it's now "JS embedding JS embedding JS". You get another (recur) of the JS embed for each additional bizdev deal struck between any two data brokers.

As a company, we have taken a firm stance that we are not an ad tech company. We charge our customers money every month for our services (reporting dashboards and APIs), and thus we don't need to "monetize on the side".

But you have no idea how against the grain this is in the media industry. On the web, "monetize on the side" is the primary business model. In fact, the CEO of a major media site once told me, "My only problem with your service is that you charge money for it. I don't think we should pay for services. Everything should be free, and you guys should figure out how to make money on your own."

With bad actors among the ad tech industry popping up every day who are happy to take advantage of this mindset, it's no surprise that the page load situation has gotten out of control.

1
192021
28