HN user

pansa2

4,068 karma
Posts29
Comments1,200
View on HN
github.com 6mo ago

Proposal: Generic Methods for Go

pansa2
1pts0
erik-engheim.medium.com 6mo ago

The many advantages of dynamic languages (2020)

pansa2
8pts0
discuss.python.org 8mo ago

Pre-PEP: Rust for CPython

pansa2
2pts0
www.ruby-lang.org 8mo ago

Ruby 4.0.0 Preview2

pansa2
199pts89
daymare.net 9mo ago

Why every Rust crate feels like a research paper on abstraction

pansa2
59pts50
patshaughnessy.net 11mo ago

Generic Types: Adding Math Puzzles to Your Code (2021)

pansa2
1pts0
www.bitecode.dev 1y ago

Python 3.13, what didn't make the headlines

pansa2
33pts11
lp.jetbrains.com 1y ago

Python Developers Survey 2023 Results

pansa2
3pts0
www.ntietz.com 1y ago

You should make a new programming language

pansa2
23pts4
www.python.org 4y ago

Python PEP 671 (draft) – Syntax for late-bound function argument defaults

pansa2
2pts1
twitter.com 4y ago

C++ Committee don’t want to fix range-based for loop in C++23 (broken for 10yrs)

pansa2
35pts10
darker.ink 5y ago

Towards Richer Colors on the Web

pansa2
16pts2
www.zdnet.com 5y ago

Why Python hasn't taken off on mobile, or in browser – according to its creator

pansa2
3pts1
abhinavsarkar.net 5y ago

Implementing Co, a Small Interpreted Language with Coroutines #1: The Parser

pansa2
3pts0
www.theregister.com 5y ago

The quest for faster Python: Pyston, Cinder, or should devs just use PyPy?

pansa2
12pts0
www.pypy.org 5y ago

PyPy v7.3.4: release of Python 2.7 and 3.7

pansa2
9pts1
tenthousandmeters.com 5y ago

How Python Dictionaries Work

pansa2
3pts1
twitter.com 5y ago

Adoption of Mypy for Python type checking: 45% already use it, 40% don't plan to

pansa2
114pts130
mail.python.org 5y ago

Python 3.10.0a6 is available, now with 100% more pattern matching

pansa2
125pts79
www.infoworld.com 5y ago

Python developers want static typing

pansa2
1pts1
www.jetbrains.com 5y ago

Python Developers Survey 2020 Results

pansa2
20pts0
3fx.ch 5y ago

Typing Is Hard

pansa2
190pts130
mail.python.org 5y ago

Python Steering Council Accepts Pattern Matching PEPs for Python 3.10

pansa2
8pts2
twitter.com 5y ago

Repl.it CEO: We're the most ambitious software startup in history

pansa2
2pts3
www.python.org 5y ago

Python Enhancement Proposal 638 – Syntactic Macros

pansa2
5pts3
thenewstack.io 5y ago

Ruby Creator Matz on the Challenges of Updating a Programming Language

pansa2
4pts0
mail.python.org 6y ago

PEP 622 version 2 (Structural Pattern Matching for Python)

pansa2
1pts0
lwn.net 6y ago

The PEPs of Python 3.9

pansa2
4pts0
pyfound.blogspot.com 6y ago

Should all strings become f-strings?

pansa2
29pts56

I always liked the fact that 10! (10 factorial) is exactly the number of seconds in six weeks.

  6 weeks * 7 days * 24 hours * 60 minutes * 60 seconds:

    6 * 7 * 24 * 60 * 60
  = 6 * 7 * (3 * 8) * (4 * 5 * 3) * (3 * 2 * 10)
  = 6 * 7 * 3 * 8 * 4 * 5 * (3 * 3) * 2 * 10
  = 6 * 7 * 3 * 8 * 4 * 5 * 9 * 2 * 10
  = 1 * 2 * 3 * 4 * 5 * 6 * 7 * 8 * 9 * 10

What’s a good small laptop that’ll run a recent Linux distro? I’d like to get one to have an ultra-portable machine for doing lightweight development work - I don’t need much more than a text editor and a C compiler.

Would a second-hand 11” MacBook Air or 12” MacBook be a good choice?

So is LuaJIT resuming active development after a decade or so of only maintenance? Great!

A lot of these changes make sense (although some of them are a bit too TIMTOWTDI for my taste) - but perhaps LuaJIT 3 would benefit from a change of name as well? Certainly with all these changes, it would be more like a separate language than merely a JIT-compiled version of Lua.

Lua is the same IIRC: open source but not open development.

It’s MIT licensed, and the maintainers are always grateful for bug reports, but all the code in the project was written by just 3 people.

The C interface to ruby is just superb.

How does it handle garbage collection? AFAIK GC is the main reason behind Lua's stack-based API: it's designed so that C code never needs to hold a pointer to a Lua object, which means an object will never be garbage-collected while C code is still trying to use it.

OTOH Python does allow C code to hold such pointers - so it requires that code to perform error-prone manual reference-counting.

How does Ruby solve this problem?

Mojo 1.0 Beta 3 months ago

they intended to make it compatible with existing Python code

That was the original claim, but it was quietly removed from the website. (Did they fall for the common “Python is a simple language” misconception?).

Now they promise I can “write like Python”, but don’t even support fundamentals like classes (which are part of stage 3 of the roadmap, but they’re still working on stage 1).

Maybe Mojo will achieve all its goals, but so far has been over-promising and under-delivering - it’s starting to remind me of the V language.

The PEP for this change is here [0] and discussion of it is here [1]. Both are very long and seem to represent a huge amount of complexity, apparently to make installing Python easier for novices?

But what about those of us who listened to Rich Hickey and prefer "simple" over "easy"? With the executable installer no longer available, how do I get a copy of python.exe, python316.dll etc onto my machine so that `C:\Python316\python.exe <script>` works, without having to think about `py`, `pymanager`, Windows Store etc?

[0] https://peps.python.org/pep-0773/

[1] https://discuss.python.org/t/pep-773-a-python-installation-m...

In a similar vein, see this page about the performance of the interpreter for the dynamic language Wren: https://wren.io/performance.html

Unlike the Zef article, which describes implementation techniques, the Wren page also shows ways in which language design can contribute to performance.

In particular, Wren gives up dynamic object shapes, which enables copy-down inheritance and substantially simplifies (and hence accelerates) method lookup. Personally I think that’s a good trade-off - how often have you really needed to add a method to a class after construction?

all the encoding/decoding functions default to utf-8

Languages that use UTF-8 natively don't need those functions at all. And the ones in Python aren't trivial - see, for example, `surrogateescape`.

As the sibling comment says, the only benefit of all this encoding/decoding is that it allows strings to support constant-time indexing of code points, which isn't something that's commonly needed.

Wouldn't this get the funding back?

The funding was Microsoft employing most of the team. They were laid off (or at least, moved onto different projects), apparently because they weren't working on AI.

The Python devs didn’t want to make huge changes because they were worried Python 3 would end up taking forever like Perl 6. Instead they went to the other extreme and broke everyone’s code for trivial reasons and minimal benefit, which meant no-one wanted to upgrade.

Even the main driver for Python 3, the bytes-Unicode split, has unfortunately turned out to be sub-optimal. Python essentially bet on UTF-32 (with space-saving optimisations), while everyone else has chosen UTF-8.

Maybe they could have two versions of the interpreter, one that’s thread-safe and one that’s optimised for single-threading?

Microsoft used to do this for their C runtime library.

> Python 2->3 transition

taking backwards compatibility so seriously

Python’s backward compatibility story still isn’t great compared to things like the Go 1.x compatibility promise, and languages with formal specs like JS and C.

The Python devs still make breaking changes, they’ve just learned not to update the major version number when they do so.

You’re right, of course: even Guido seems to have been moved off working on CPython and onto some tangentially-related AI technology.

However, Faster CPython was supposed be a 4-year project, delivering a 1.5x speedup each year. AFAIK they had the full 4 years at Microsoft, and only achieved what they originally planned to do in 1 year.

PyPy is a fantastic achievement and deserves far more support than it gets. Microsoft’s “Faster CPython” team tried to make Python 5x faster but only achieved ~1.5x in four years - meanwhile PyPy has been running at over 5x faster for decades.

On the other hand, I always got the impression that the main goal of PyPy is to be a research project (on meta-tracing, STM etc) rather than a replacement for CPython in production.

Maybe that, plus the core Python team’s indifference towards non-CPython implementations, is why it doesn’t get the recognition it deserves.

Fundamentally, CPUs use 0-based addresses. That's unavoidable.

We can't choose to switch to 1-based indexing - either we use 0-based everywhere, or a mixture of 0-based and 1-based. Given the prevalence of off-by-one errors, I think the most important thing is to be consistent.

The reason many languages prefer `length` to `count`, I think, is that the former is clearly a noun and the latter could be a verb. `length` feels like a simple property of a container whereas `count` could be an algorithm.

`countof` removes the verb possibility - but that means that a preference for `countof` over `lengthof` isn't necessarily a preference for `count` over `length`.

Yeah, you could argue that choosing C is just choosing a particular subset of C++.

The main difference from choosing a different subset, e.g. “Google C++” (i.e. writing C++ according to the Google style guide), is that the compiler enforces that you stick to the subset.

statically-typed

Embed/extend in C

Is Lily intended to be (or could it be used as) a statically-typed alternative to Lua?

Personally I'm happy with dynamic typing for scripting - but I suspect many people would welcome a statically-typed option, and there don't seem to be many available.

You basically need two pieces of state

That’s enough for INDENT, but for DEDENT you also need a stack of previous indentation levels. That’s how, when the amount of indentation decreases, you know how many DEDENTs to emit.

The requirement for a stack means that Python’s lexical grammar is not regular.