HNHacker News
TopNewBestAskShowJobs

tlocke

420 karma · joined May 17, 2011

https://www.tlocke.org.uk/
submissionscomments
tlocke··on Python Best Practices for a New Project in 2021
My feeling is that I want anything that could change the meaning of the code to be down to me making a manual edit. So I'm quite happy for the Black formatter to automatically rewrite my code as it never changes its meaning. For anything else I like to be in the driving seat.

Anyway, that's just my feeling at the moment, I'm sure others have a different take.

tlocke··on Python Best Practices for a New Project in 2021
Flake8 Alphabetize will just give you warnings about import order, whereas isort will actually change the code itself.

So as I see it there are two types of tool, formatters and checkers. A formatter doesn't alter the Abstract Syntax Tree (AST). In other words it doesn't alter the meaning of the code, just how it looks (eg. the formatter Black). A checker on the other hand looks only at the AST and just gives warnings in your editor, and then it's up to you to change it or not.

The import order is fixed in the AST, so it falls outside the scope of Black (which never changes the AST). So I felt there was a need for a tool that worked as a checker that just gives warnings in your editor if your imports don't conform to PEP8, and hence Flake8 Alphabetize.

It's worth mentioning that Flake8 Alphabetize follows Black's philosophy of having only one way of doing things, so a project can standardise on Flake8 Alphabetize and everyone's imports will look the same.

Anyway, any feedback is welcomed:-)

tlocke··on Python Best Practices for a New Project in 2021
I think you mean Flake8 rather than Sense8? Anyway, gives me a chance to plug Flake8 Alphabetize, a Flake8 plugin for import ordering https://github.com/tlocke/flake8-alphabetize
tlocke··on Free Software and Freakonomics
Perhaps we've got it the wrong way round, and rather than asking how Open Source contributors can be paid more, what about asking how everything can be cheaper? This is in fact what's happening as Open Source is deflationary. It's the reason that various central banks round the world can print so much money without the inflation rate getting as high as one would expect. I contribute to a few Open Source projects, and that's the approach I favour.
tlocke··on Organicmaps: Android and iOS offline maps app for travelers, tourists, hikers
I'm glad you mentioned StreetComplete, I'm a great fan of it. For those that don't know it's an Open Source Android app that shows OpenStreetmap with pins in showing where information is needed. For example tapping a pin with a bench icon will ask you, 'is this bench still here?' and you just tap yes or no. Then there are more complicated ones like the opening hours of a shop. It's a fantastic way to contribute to OpenStreetmap, and it's a bit of a 'gateway drug' to more advanced editors such as the one on the OpenStreetmap website. For example, I might be entering house numbers on a local street and find that the buildings on the map don't match what's really there, and then I'll go into the editor the OpenStreetmap website to correct the map. The only shortcoming of StreetComplete is that the map isn't refreshed very often, but despite that I highly recommend it.
tlocke··on Why Nuclear Power, Not Renewables, Is the Path to Low-Carbon Energy (2020)
If cost were the only thing you cared about, then no nuclear power stations would ever be built, they're simply much more expensive than gas, wind or solar. From an environmental point of view you wouldn't have nuclear either, the reason is that you can't turn it up and down as you can with gas, and so you always need to the gas to make up the difference between supply and demand. So really, nuclear is in competition with wind and solar, and nuclear will always lose out because it's so expensive.
tlocke··on Why Nuclear Power, Not Renewables, Is the Path to Low-Carbon Energy (2020)
Baseload isn't really relevant when talking about meeting demand. What's important is that for any point in time all the energy sources added up are equal to the demand. System operators will use the cheapest source first, which is always renewables, then (at least in the UK) it'll typically use gas generation to meet the shortfall. Gas is particularly good for this because it can easily be turned up and down. In all this, baseload isn't really a relevant concept.

In the UK, where there's a semblance of a free market in electricity generation, it's been possible for decades for nuclear power stations to be build by private industry. None have because they just can't compete economically. The cases where they have been built have all been when the government intervened in the market and heavily subsidized them. Nobody really knows why!

tlocke··on Pg8000 – Pure-Python PostgreSQL driver
I maintain pg8000, and it has two APIs: the standard DB-API 2 accessed with pg8000.dbapi and its own native API at pg8000.native.

The native API is a lot simpler, and so I'd use that if you can. The native API is really my suggestion for the next version of DB-API, so DB-API 3. I'd be interested to know people's thoughts on this, and maybe we could put together a draft specification?

tlocke··on Bulk loading into PostgreSQL: Options and comparison
This is true. I'm the maintainer of pg8000, a Python driver for PostgreSQL. Here are the docs for how you'd do this using pg8000:

https://github.com/tlocke/pg8000#copy-from-and-to-a-file

The standard API for database access in Python is DB-API 2 and it doesn't include support for COPY , so each driver may implement it differently.

There's another aspect to this, and that's the format of the file to be ingested as it can be 'text', 'CSV' or 'binary'. If you're generating the file yourself then you have a choice, but whether 'binary' is faster than 'CSV' I just don't know.

tlocke··on What would happen if computers never got any faster?
I've sometimes wondered what a hypothetical super-intelligent being could program using a BBC Micro. Perhaps they could exploit the resonances of the circuits to perform analogue computation? I heard that evolutionary algorithms sometimes exploit the physical properties of circuits, and so to control for that there are two computers running the same code at different temperatures. I think they literally put one in a fridge.
tlocke··on Open Source does not mean “Includes Free Support”
As an Open Source maintainer, I feel ambivalent about the issues filed against projects I maintain. While a particular issue may seem to be written with a sense of entitlement, it nevertheless often tells me something useful. I'd much rather someone file an issue than not, even if the tone was a bit off.
tlocke··on No More Free Work from Marak: Pay Me or Fork This
In a URL, say https://www.example.com/ a particular location is specified for the content. In contrast, with a decentralized system a hash of the content would be used to find the actual content, so-called content-addressable. See https://ipfs.io for more info.
tlocke··on No More Free Work from Marak: Pay Me or Fork This
> Seriously. What's the point of open source if companies just steal it, build billion dollar industries on top, and then lock everything down?

I work on pg8000 https://github.com/tlocke/pg8000 which is used by Amazon, Google etc. I'd argue that pg8000 and any Open Source software doesn't give them a competitive advantage, because in order to have a competitive advantage you have to have something that your competitors don't have. It's more that they'd be at a competitive disadvantage if they didn't use Open Source software.

That's not to say there aren't problems with the big tech companies, but I'd say that Open Source isn't where the problems lie. In my view the problems stem from the nature of the web, in that it is a centralized architecture that inevitably concentrates power. Something like IPFS https://ipfs.io would help liberate the web?

tlocke··on The cult of the free must die
Okay, let's go with your figure of 0.1% of the cost of the worker. My point is that if society were to switch to Open Source software that 0.1% is compounded because all the other goods and services that a business has to buy become cheaper. This then means that they can lower their prices while still making the same profit. Which in turn lowers the cost of inputs to other businesses in a virtuous cycle.

So using your analysis of the single worker, which I agree with, it actually makes a very big difference when applied to all workers.

To address your point about the training costs of moving from proprietary to Open Source, again this disappears if the move happens at scale. It disappears because every worker would have learnt Linux at their previous job (or at school / college etc.) and so in fact the cheapest thing becomes to use Linux.

What your argument demonstrates is the network effects of proprietary software, whereby if you're the first to use Open Source software it's a disadvantage, but if everyone used it, it would be an overall advantage to society.

The question then becomes, how do we get from here (often proprietary) to there (mostly Open Source)?

tlocke··on The cult of the free must die
Is that true? I can buy a blank laptop for £215 (https://www.pcspecialist.co.uk/notebooks/gemini-IV/) and then install Debian for free. The same laptop with Microsoft Windows / Office costs £352. So I'd say that in this case at least, software is a dramatic part of the cost.
tlocke··on The cult of the free must die
Perhaps the problem is the reverse: The more things that aren't free, the more money people need. By expanding the amount of free things, that reduces the amount of money required to produce new free things. Put another way, if 'software is eating the world', then if it's free software the cost of goods and services should drop dramatically.
tlocke··on Amazon Ion
See Zish for an improved JSON:

https://github.com/tlocke/zish

It has timestamps and decimals. Full disclosure, I am the author.

tlocke··on How to fuck up software releases
For Python projects I use the excellent Versioneer:

https://github.com/warner/python-versioneer

It means you only specify the version as a git tag, and all the other things that need a version number get it from that.

tlocke··on Don't get locked up into avoiding lock-in
Isn't it true that you can avoid vendor lock-in with Open Source because you have a choice of companies that will support it? For example with PostgreSQL there are a variety of companies that provide support.
tlocke··on Zapping Nuclear Waste in Minutes Is Nobel Winner’s Holy Grail Quest
A big problem with nuclear is expense. The figures from France are misleading because the state and the power companies are deeply entangled financially. A clearer view is possible in the UK because they have market system, and subsidies tend to be more transparent. The message from the UK is that nuclear power is not financially viable, and no nuclear power stations would be built without government subsidy. The subsidy required is far greater than that required by renewables. See https://www.theguardian.com/uk-news/2017/nov/22/hinkley-poin...
tlocke··on The rise and rise of JSON (2017)
Surely it's a problem that in JSON, duplicate keys are allowed?

https://stackoverflow.com/questions/21832701/does-json-synta...

tlocke··on The rise and rise of JSON (2017)
Have you seen Zish? https://github.com/tlocke/zish It's designed to be an improvement on JSON, so it supports comments and has native timestamp, bytes and decimal types.
tlocke··on YAML: probably not so great after all (2017)
Zish https://github.com/tlocke/zish supports comments (but they're not round-trip comments) and also extra data types such as timestamp and bytes.

It's still in its early stages, so if anyone's got any comments I'm interested in hearing them :-)

tlocke··on Data serialization
You might be interested in Zish https://github.com/tlocke/zish which has support for maps, timestamps, binary data and decimal types.
tlocke··on Mark – A simple and unified notation for both object and markup data
You might be interested in Zish:

https://github.com/tlocke/zish

It's a data serialization format with timestamp, bytes and decimal data types.

tlocke··on The Last JSON Spec
This is quite brilliant, thanks billpg. I'm also amazingly grateful that someone's taken an interest in Zish :-) These questions will all require some thought to properly understand and respond to, with no-doubt some changes to the spec. So I've opened an issue and put the comment at:

https://github.com/tlocke/zish/issues/2

tlocke··on The Last JSON Spec
What about Zish? It's like JSON but with comments, a timestamp type, a decimal type and a bytes type:

https://github.com/tlocke/zish

(as the author, I'm biased)

tlocke··on Zish – An alternative to JSON
Good point, so in your view Zish shouldn't have any comments at all? I don't think they're allowed in JSON either.
tlocke··on Ask HN: What do you want to see in Ubuntu 17.10?
FLAVOR: All

HEADLINE: Embrace the spirit of Open Source, not just comply with the letter of the law

DESCRIPTION:

Here's an extract from the Software Freedom Conservancy report on Canonical's licensing policy:

> Redistributors of Ubuntu have little choice but to become expert analysts of Canonical, Ltd.'s policy. They must identify on their own every place where the policy contradicts the GPL. If a dispute arises on a subtle issue, Canonical, Ltd. could take legal action, arguing that the redistributor's interpretation of GPL was incorrect. Even if the redistributor was correct that the GPL trumped some specific clause in Canonical, Ltd.'s policy, it may be costly to adjudicate the issue.

https://sfconservancy.org/news/2015/jul/15/ubuntu-ip-policy/

tlocke··on Ask HN: Where are you located?
Bath, UK
← PreviousPage 4 of 5Next →