HNHacker News
TopNewBestAskShowJobs

ubernostrum

12,994 karma · joined June 4, 2008

submissionscomments
ubernostrum··on Trump Just Signed a Law That Changes Life Aboard Airlines
There are airlines which charge for use of the overhead bin.
ubernostrum··on Trump Just Signed a Law That Changes Life Aboard Airlines
Quite a few airlines in Europe tack "fuel surcharge" fees onto tickets, especially those booked using frequent-flyer miles. Depending on the airline and destination, the "fuel surcharge" -- which must be paid in cash -- for redeeming miles can approach the cost of just buying a ticket.

For example, if you book a flight from the US to London on American Airlines, redeeming miles, you'll be on the hook for around $10 in taxes. If you book the same flight, using American Airlines miles, but happen to be unfortunate enough to get it on their partner British Airways, you'll get dinged for around five hundred dollars in "fuel surcharge".

Last time I checked, Brazil was the only country where this is illegal.

ubernostrum··on How I Judge the Quality of Documentation in 30 Seconds (2014)
Well, I'm both a producer and a consumer of open source code.

So is Eric, who wrote the "entitled" post being complained about.

ubernostrum··on Python is becoming the world’s most popular programming language
No, again you're thinking of "static", not "strong".

Strong versus weak is historically poorly defined, and there's no single universally-accepted definition, but you can get the gist of it from considering the following:

    a = '1'
    b = 2
    c = a + b
In JavaScript, the above code results in the name 'c' being bound to the string value '12'. In Python, the above code raises TypeError. Generally, "weak" typing refers to the idea that the language may coerce the values of operands to other types in order to make an operation succeed (in the above, JavaScript coerced the value of 'b' to a string and interpreted the '+' operator as asking for string concatenation, hence the result is the string '12'). "Strong" typing generally means the language won't do that, and will error out on you if you attempt an operation on values of incompatible types.

"Static" versus "dynamic" typing is a completely different set of terms. There's also some debate over definitions, but broadly, consider the following expression:

    a = 1
In a statically-typed language, both the name 'a' and the value 1 have types, and in order to bind names to values their types must be compatible. So in the above, it's likely that both 'a' and 1 are of type int, so the assignment expression would be legal. Later attempting to bind 'a' to a value of a type incompatible with int (say, 'a = "foo"') would fail. Statically-typed languages also come with an expectation that all expressions can be checked for compatible types without needing to execute the code, and that a tool will exist to do this checking for you.

In a dynamically-typed language, however, only values have types; names do not, so binding a name to a value of a particular type does not foreclose later re-binding to a value of a different type (i.e., the name 'a' might be bound to an int now, and get re-bound to a string later). This means there will be cases in a dynamically typed language where the only way to verify correctness of an expression is to execute the code (though you can usually check a high percentage without running the code).

Python is strongly typed and dynamically typed.

ubernostrum··on Facebook Says Hackers Stole Detailed Personal Data from 14M People
but you are willingly putting your information there, just don't

I know you're the Area Man Constantly Mentioning He Doesn't Own a TV[1], but...

Facebook probably has a profile on you containing personally identifiable information. If literally anyone who has ever had your phone number or email address also had a Facebook account, and gave Facebook access to their contacts, that's the ballgame. So maybe be a little less sanctimonious about telling others not to give away their data, because I'd bet all the money in my wallet Facebook has data on you.

[1] https://www.theonion.com/area-man-constantly-mentioning-he-d...

ubernostrum··on Boltons: A set of BSD-licensed, pure-Python utilities
In addition to the other reply, there's often a reluctance -- on the part of both the Python core team and the developers of popular third-party code -- to add things to the standard library, since doing so ties you to Python's development process and release cycle. This is one reason why pip is not in the standard library, for example (instead, Python ships a module which will go get pip for you); it needs the ability to develop and release at its own pace and on its own terms.
ubernostrum··on Python is becoming the world’s most popular programming language
People are often introduced first to Python by way of scripting

I don't believe this is true, and I don't believe it's been true for quite some time.

First encounters with Python now tend to be via frameworks, whether for web development, machine learning, data science or automation.

ubernostrum··on Python is becoming the world’s most popular programming language
Python is strongly typed, insofar as the term has a meaningful definition at all.

You meant "give me a statically typed language". Which may not actually be what you want, since statically typed languages can be, and some historically have been considered, weakly typed (C, for example).

ubernostrum··on Leaked Google briefing, admitting a “shift towards censorship”
Proceeding with censorship seems to carry the risk of losing immunity under Section 230.

Nope. The whole point of Section 230 is platforms can make and enforce rules, and still have a safe harbor. Otherwise, they all would have lost their safe harbor decades ago.

ubernostrum··on Tech Workers Now Want to Know: What Are We Building This For?
Ask the Roman Republic how the "wisdom" of governance by the landed gentry worked out.
ubernostrum··on The Hiring Post (2015)
Do they also do the on-site interview?

Look, I've done a lot of interviews as the interviewer. This attitude that we have to design processes as if there are five hundred quintillion octillions of googolplexes of novemdecillions of cheating lying "fake coders" for every one qualified person is not rooted in reality, nor is the level of paranoia you're displaying. There are perfectly reasonable processes you can use which will catch a cheater if you actually get one. But designing a process entirely around the assumption that everyone is a cheater trying to lie their way into your company is just not useful.

ubernostrum··on Tech Workers Now Want to Know: What Are We Building This For?
how is there a system of checks and balances to keep the voters from appropriating everything

The US doesn't have one of those.

Literally. The people of the United States can, without consent of Congress or the President or the Supreme Court, do everything you just said, via the amendment-convention process (Congress does not have the option to deny a convention when at least 2/3 of states call for it). Once the convention's underway, even state legislatures can be bypassed by conventions in the states.

Thus it's possible to get amendments into the US Constitution without them ever having been voted on or even considered by Congress or the state legislatures. And if you're worried about a populist wave "appropriating everything" in other countries, why not worry about it in the US? It's just as possible.

ubernostrum··on Tech Workers Now Want to Know: What Are We Building This For?
Social Democracy Overnight: Why is this desirable, outside of theory? The whole of history indicates to us that collectivism works either on small scales, or as a disguised totalitarianism.

Here we observe the not-so-subtle attempt to shift the debate from "social democracy" to "collectivism", as if the two terms are synonyms.

We also see a denial that mixed economies with strong social safety nets can ever work on, say, the scale of a nation. Despite plenty of evidence available, in the real world, that they can.

ubernostrum··on The Hiring Post (2015)
but the in-person faker would be astoundingly obvious

Yet, based on your previous comment, you think the person will be able to BS their way through a conversation with you about code they didn't write and don't understand. I don't see how you can hold both of those positions simultaneously.

ubernostrum··on Shutting Down Google+ for Consumers
lest the rank-and-file revolt

The rank-and-file are extremely well compensated, with cash, with stock, with on-the-job perks. Why would they bite the hand that feeds them? A lot of people will put up with incredible violations of their principles before they'll risk losing a comfortable position.

ubernostrum··on The Hiring Post (2015)
Do me a favor and give me your answer to this:

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

ubernostrum··on The Hiring Post (2015)
How do you know, in your in-person whiteboard interview, that the candidate isn't wearing an earpiece and a microphone, and someone else is whispering a solution, and convincing explanatory patter, into their ear? Do you make them whiteboard in a special room that's set up as a Faraday cage?
ubernostrum··on House lawmakers pass bill to regulate airplane seat size, legroom
The pre-merger Alaska Airlines fleet contains four different variants of the Boeing 737, with one of those (the 737-900) outfitted in either of two seating configurations.

Only the 737-800 and the 737-900 "V2" configuration are outfitted with a dedicated section of extra-legroom seats near the front of the economy cabin. In the others (737-400, 737-700, and 737-900 "V1"), the only way to get additional legroom in the economy cabin is to snag an exit-row or bulkhead seat.

For sake of comparison:

* 737-900 "V1" has two exit rows with additional legroom, and one bulkhead row with additional legroom, for a total of 18 seats, in a 165-seat economy cabin, with additional legroom.

* 737-900 "V2" has two exit rows with additional legroom, and four rows at the front of the economy cabin designated "premium", with 3-4 more inches of legroom compared to non-"premium" non-exit-row seats, for a total of 30 seats, in a 162-seat economy cabin, with additional legroom.

The worst configuration is the 737-700, where one of the exit rows has only two seats each side of the aisle; this brings it down to only 16 economy seats available with additional legroom. The best is the 737-800, which has five rows of "premium" plus two exit rows, for 42 seats with additional legroom.

ubernostrum··on The Python Unicode Mess
Second line should read as below, can't edit:

False if a.__eq__(b) is False (short-circuiting the entire expression to False), or if a.__eq__(b) is NotImplemented and b.__eq__(a) is False.

ubernostrum··on The Python Unicode Mess
It makes sense if you realise that a == b means a,b have the same type and their values are equal.

Which is wrong.

In Python, "a == b" is:

True if a.__eq__(b) is True (short-circuiting the entire expression to True), or if a.__eq__(b) is NotImplemented and b.__eq__(a) is True.

False if a.__eq__(b) is False (short-circuiting the entire expression to False), or if a.__eq__(b) is NotImplemented and b.__eq__(a) is True.

TypeError if a.__eq__(b) is NotImplemented and b.__eq__(a) is NotImplemented.

ubernostrum··on The Python Unicode Mess
Python as of 3.3 chooses an internal representation on a per-string basis. This encoding will be either latin-1, UCS-2, or UCS-4, and the choice is made based on the widest code point in the string; Python chooses the narrowest encoding capable of representing that code point in a single unit.

This does mean that a string which contains, say, some English text and an emoji will "blow up" into UCS-4, but the overhead isn't that severe; most such strings are not especially large. It also means that strings containing only code points < U+00FF are smaller in memory on Python 3.3+ than previously, since prior to 3.3 they would be using at least two bytes per code point and now use only one.

ubernostrum··on The Python Unicode Mess
Serious question: why would you want to do this?

Have you never, in your entire life, encountered a string data type with a length rule? All sorts of ID values (to take an obvious example) either have fixed length, or a set of fixed lengths such that every valid value is one of those lengths, and many are alphanumeric, meaning you cannot get round length checks by trying to treat them as integers. Validating/understanding these values also often requires identifying what code point, not what grapheme, is at a specific index.

Plus there are things like parsing algorithms for standard formats. To take another example: you know how people sometimes repost the Stack Overflow question asking why "chucknorris" turns into a reddish color when used as a CSS color value? HTML5 provides an algorithm for parsing a (string) color declaration and turning it into a 24-bit RGB color value. That algorithm requires, at times, checking the length in code points of the string, and identifying the values of code points at specific indices. A language which forbids those operations cannot implement the HTML5 color parsing algorithm (through string handling; you'd instead have to do something like turn the string into a sequence of ints corresponding to the code points, and then manually manage everything, and why do that to yourself?).

ubernostrum··on The Python Unicode Mess
Consider the codepoint U+1F4A9 ("PILE OF POO").

This encodes to the byte sequence F0 9F 92 A9 in UTF-8. Notice that every one of these bytes has a value > 0x7F, which means they're all outside the ASCII range.

That's one of the useful properties of UTF-8: you know that a code point requiring multi-byte encoding will never contain any bytes that could be confused for ASCII, because every byte of a multi-byte code point will be > 0x7F.

Which in turn means that if you use any processing mechanism that only alters bytes which are in the ASCII range, and passes all other bytes through unmodified, you are guaranteed not to modify or corrupt any multi-byte UTF-8 sequences.

ubernostrum··on The Python Unicode Mess
At the same time, this result is entirely dependent on the types involved. For example, "1.0 > 0" has a well-defined answer, and Python returns it.

Considering the expression "x > y", the full process is:

1. Call x.__gt__(y).

2. If that returns a bool, that's the result. If it raises an exception, propagate the exception.

3. If it returns the sentinel value NotImplemented, attempt the reflected version of the operation: y.__lt__(x).

4. If that returns a bool, that's the result. If it raises an exception, propagate the exception.

5. If it returns the sentinel value NotImplemented, raise TypeError and inform the programmer this operator is not valid on these types.

ubernostrum··on The Python Unicode Mess
Python has operator overloading, though, so a flat rule that comparisons involving values of different types must always be a type error would actually reduce the power of the language. Granted, there aren't a ton of use cases where it's important to be able to do this, but it is useful on occasion.
ubernostrum··on The Python Unicode Mess
you cant ever correctly show filenames to users either

If I create a file whose name consists entirely of bytes that correspond to non-printable characters, how would you display that in the language of your choice?

If I create a file whose name cannot possibly be valid UTF-8, how would you display that in the language of your choice?

Both of these things are legal to do on at least some systems. Presumably you have in mind a language which will magically handle this case with no extra effort from the programmer, though, so I'm curious to know the language and what it would do.

ubernostrum··on The Python Unicode Mess
And when do users care about text length?

When validating many types of data submitted via the web.

ubernostrum··on The Python Unicode Mess
One thing that amuses me given the number of complaints about the Python 3 string transition is how vastly better Python 3 is for working with bytes. The infrastructure available is light-years ahead of what Python 2 offered, precisely because it gave up on trying to also make bags of bytes be the default string type.
ubernostrum··on The Python Unicode Mess
I would express it more as "programmers in Unix environments like to act as if everything still uses the C locale everywhere, all the time".
ubernostrum··on The Python Unicode Mess
In Python 2, if you have a series of bytes -or- a "string", the language has no opinion about the encoding

This is incorrect. Python 2 lets you get away with a lot of things, but some string-y operations on Python 2 bytestrings will still trip the "need to know the encoding" issue. And absent you telling it the encoding, Python 2 will assume ASCII and begin throwing exceptions as soon as it sees a byte outside the ASCII range.

← PreviousPage 7 of 34Next →