HNHacker News
TopNewBestAskShowJobs

BerislavLopac

32,006 karma · joined July 21, 2008

submissionscomments
BerislavLopac··on Ask HN: What is your go-to stack for the web?
For pure APIs: pyapi-server [0]. For classic Web sites: Starlette [1], with SQLAlchemy Core [2] for database integration. Or, if you prefer something with more batteries included, FastAPI [3].

[0] https://pyapi-server.readthedocs.io

[1] https://www.starlette.io/

[2] https://docs.sqlalchemy.org/en/20/

[3] https://fastapi.tiangolo.com/

BerislavLopac··on The Wetware Crisis: The Dead Sea Effect (2008)
You can't -- but that's not menial work.
BerislavLopac··on The Wetware Crisis: The Dead Sea Effect (2008)

  > A single talented carpenter with an energetic but otherwise totally unskilled
  > helper can accomplish more in a shift than two talented carpenters together.
  > If you don't have someone to run to the truck for nails, hold shit, move
  > ladders, etc. productivity suffers because your talent is wasting time on
  > menial tasks.
But you are mistaken -- each of us (the software engineers) already has numerous helpers who fit this description perfectly. The only difference is that we don't call them "apprentices" -- we call them compilers, interpreters, build tools and the like. Probably the only term that is commonly used on both types of helpers is "git".

Joking aside -- if you find yourself and your team spending too much time on menial tasks, you need to focus more on automating them. Of course, how much can be automated depends on how much hardware is involved in your work; as long as we're in software world, pretty much anything can be automated.

BerislavLopac··on How Programming Languages Got Their Names
There is also C#, where # represents a duplication of "++", on top of each other. Technically, the # is not the sign for the musical sharp key (♯), but "C sharp" sounds better than "C hash", "C pound" or "C octothorp". :)

Edit: On an unrelated note, TIL that the sign used on telephone keys is also not #, but ⌗ -- a.k.a. the "Viewdata square" [0].

[0] https://en.wikipedia.org/wiki/Viewdata#Keypad_symbols:_the_s...

BerislavLopac··on How Programming Languages Got Their Names
Oh, I was disappointed that it's missing some interesting (albeit often well-know) cases like C++, C#, JavaScript or even PHP.
BerislavLopac··on A parliament of owls and a murder of crows: How groups of birds got their names
TIL that a group of coworkers is called "an apathy".
BerislavLopac··on Reasons to avoid static type checking in Python
I'm not really sure what is meant by "avoiding static typing" in Python -- it's just like saying "avoiding unit tests", which is done by not running them (or even writing them) in the first place.

Python is strongly typed, but it does not mandate static type analysis -- unlike most other typed languages, where it is mandatory at compilation time. But if you choose to use it, there are tools which will run it for you at any point in time (mypy being the reference implementation). You don't even have to write any special annotations for that: the checker will try to infer the type when possible, or use Any when it isn't.

The crucial thing to understand is that Python is still dynamic at runtime -- there are no checks that an argument is of the correct type defined for the corresponding parameter. So your program can fail the static analysis but correctly run in practice, unlike most other statically checked languages.

Another effect of the above, which is often overlooked, is that many developers tie themselves into knots to get the type annotations right on unit tests. This is completely missing the point, as unit tests and static typing are at completely cross purposes: while static analysis evaluates, as the name implies, the code in its static state, the unit tests only make sense when they are executed, i.e. at runtime.

So the practical rule of thumb, learned from practice, is:

1. Regularly run the static analysis on your application (and library) code, adding any necessary annotations, to weed out various problems that might arise from mismatched types.

2. Write thorough unit tests -- ideally with plenty of property tests with tools like hypothesis [0] -- and run them regularly.

[0] https://hypothesis.readthedocs.io

BerislavLopac··on The Source of Europe's Mild Climate
> the UK hasn't had too many hurricanes in its history

In other words: In Hertford, Hereford and Hampshire, hurricanes hardly ever happen.

BerislavLopac··on Ask HN: What's the best car without undesirable features?
I'm not sure, hence the "I think". :)
BerislavLopac··on Python Packaging, One Year Later: A Look Back at 2023 in Python Packaging
Yes, but PEP 631 is still relevant here.
BerislavLopac··on Ask HN: What's the best car without undesirable features?
I don't think that really exists -- the cars either don't have the connectivity, or it's relatively modern (4G+). For the older cars we had to use dongles, which in some cases were even 2G.
BerislavLopac··on Ask HN: What's the best car without undesirable features?
There is essentially a mobile "modem" built in.
BerislavLopac··on Ask HN: What's the best car without undesirable features?
> 1. Internet connectivity. If the car is connected, it's tracking me.

Just because you can't connect to the Internet from your car doesn't mean that the car is not being tracked. Pretty much all cars built since 2016 or so have built-in infrastructure to collect various telemetry and send it to the manufacturer; prior to that there were dongles that were installed by various parties (automotive clubs, insurance companies, fleet owners...).

Most manufacturers also offer (or are working on offering) that data to third parties, although in most jurisdictions it requires the vehicle driver/owner to explicitly agree to it. In any case this whole area is still in its infancy, and we can expect to see more standardisation and wide use of that data in the coming years.

Source: worked in that industry until recently.

BerislavLopac··on Python Packaging, One Year Later: A Look Back at 2023 in Python Packaging
No, use PDM. ;)

The main problem with Poetry is that it still does not support PEP 621. [0]

[0] https://github.com/python-poetry/poetry/issues/3332

BerislavLopac··on Show HN: Marimo – an open-source reactive notebook for Python
You should try pip-tools.
BerislavLopac··on Ask HN: Are tech layoffs happening abroad?
Well, this says a lot: https://hnhiring.com/trends?locations=london
BerislavLopac··on The Ugliest Airplane: An Appreciation of the Transavia AirTruk
This reminds me of the introduction of the V-style [0] in ski jumping: it was originally deemed inappropriate by the judges, who scored it lower, but it provided so much more distance that today it's the most widely used technique.

[0] https://en.wikipedia.org/wiki/Ski_jumping_techniques#V-style

BerislavLopac··on GitUI
Thank you, that's exactly what I wanted to write, but my phone hiccuped in the middle of writing that comment and I wasn't sure if it was posted at all. :rolleyes:
BerislavLopac··on GitUI
I'm not sure what's kind of of operations could be done by "dragging branches around", but in GitKraken
BerislavLopac··on Game-icons.net: Free icons for your games
> XMLHttpRequest wasn't a widely known thing yet. (I didn't hear of it until maybe '04 or '05, but it looks like it first appeared in '99?)

My memory says that it was first implemented in IE 5.5, which was released in 2000. Wikipedia says [0] that it first appeared in IE 5.0 but with a different syntax.

[0] https://en.wikipedia.org/wiki/XMLHttpRequest#History

BerislavLopac··on What I wish someone had told me
This is literally the whole business model of Y Combinator.
BerislavLopac··on How many CPU cores can you use in parallel?
There are only two hard problems in distributed systems: 2. Exactly-once delivery 1. Guaranteed order of messages 2. Exactly-once delivery [0]

[0] https://twitter.com/mathiasverraes/status/632260618599403520

BerislavLopac··on How many CPU cores can you use in parallel?
> Last updated 15 Dec 2023, originally created 18 Dec 2023

I respect Itamar even more after realising that he has invented the time machine... :o

BerislavLopac··on Man with no ticket or passport flew from copenhagen to Los Angeles, FBI says
> He may "simply" have arrived from a non-Schengen origin

Wouldn't he still need a passport to get on this first flight anyway?

BerislavLopac··on Unproductive 'laggards' employ 70% of UK workers
https://archive.ph/NHE4s
BerislavLopac··on NetworkX – Network Analysis in Python
NetworkX's documentation is the source of one of the most surreal but true sentences ever written (with just a slight alteration) [0]:

  A lobster is a tree that reduces to a caterpillar when pruning all leaves.
[0] https://networkx.org/documentation/latest/reference/generate...
BerislavLopac··on Services across England now lag far behind East Germany
> The question is, why do voters allow it?

The truth is, they don't really have a choice. The Conservatives and their financial backers have been taking full advantage of the electoral system in the UK, which is how they reached 56% of seats in the House of Commons by winning only 43.6% of the vote.

BerislavLopac··on Pythonicity: Composition vs. Inheritance
> So a better question might be which version is more flexible or reusable?

In fact, inheritance has nothing to do with reusability (or flexibility): it's point is to provide typing hierarchy, so the code can follow the Liskov substitution principle.

In "traditional" Python, which is dynamically typed and never statically analysed, there were no built-in controls over what is being passed at runtime, so the only real purpose for inheritance was to reuse code. This changeds with the introduction of typing annotations -- while the runtime is still fully dynamic, you can use mypy and other static analysis tools to minimise type-related errors before deploying.

In fact, Python has a great way to both support composition and support interfaces without requiring inheritance: a combination of typing.Protocol and mixins.

BerislavLopac··on The Changing "Guarantees" Given by Python's Global Interpreter Lock
This implies that, if CPython differs from that specification in any way, it is not, in fact, Python. What have I been using all these years, I wonder?
BerislavLopac··on The reason to use Protobuf is not performance
> pick a standard (openapi? jsonschema? something else?)

This is a false dichotomy, as OpenAPI and JSON Schema are complementary: as of version 3.1, OpenAPI use JSON Schema to describe request and response payload content (prior to that version it was almost compatible).

They describe different things: OpenAPI describes the request-response API model, while JSON Schema can be used to specify contents of any JSON-encoded data -- for example in streaming messages or document databases.

There is also AsyncAPI, which is designed to document and specify the event-based API, for example in a system using Apache Kafka or a similar queue to communicate.

← PreviousPage 7 of 34Next →