...

pansa2

3306

Karma

2020-01-24

Created

Recent Activity

  • > Cristal became ubiquitous around the world

    Not quite; in New Zealand they're surprisingly rare. I've never seen them for sale there, even though they're common in Australia.

  • Yes, a Father Ted Kilnettle Shrine Tape Dispenser is an alternative to a Correct Horse Battery Staple

  • Is it common in Julia to use multiple-dispatch on 3 or more arguments, or just double-dispatch?

    Julia definitely made the right choice to implement operators in terms of double-dispatch - it’s straightforward to know what happens when you write `a + b`. Whereas in Python, the addition is turned into a complex set of rules to determine whether to call `a.__add__(b)` or `b.__radd__(a)` - and it can still get it wrong in some fairly simple cases, e.g. when `type(a)` and `type(b)` are sibling classes.

    I wonder whether Python would have been better off implementing double-dispatch natively (especially for operators) - could it get most of the elegance of Julia without the complexity of full multiple-dispatch?

  • > Most iterators provide the ability to walk an entire sequence [...] Calling the iterator again walks the sequence again.

    > "Single-use iterators" break that convention, providing the ability to walk a sequence only once.

    This seems similar to the difference between an "iterable" and an "iterator" in Python (and between `IEnumerable` and `IEnumerator` in C#).

    A Python list `l = [1, 2, 3]` is an iterable, and you can do `for v in l: print(v)` multiple times. But `iter(l)` is an iterator and `for v in i: print(v)` will only work once.

  • Why does this post say “Python-style syntax”, but “SYNTAX.md” shows a “clean syntax inspired by JavaScript and C-like languages”?

HackerNews