News for hackers. Stuff that matters.

olavk

Re:Introduction to Object Oriented Programming in Python on Wednesday October 24, 2018 @02:48PM (#18295238)
If you only write code which you yourself will read and maintain, then you should definitely do whatever you feel works best for you and matches your way of thinking.
Re:Introduction to Object Oriented Programming in Python on Wednesday October 24, 2018 @01:51PM (#18294714)
Well written code is obviously better than badly written code. But why assume the functional-style is better written than the idiomatic Python? I think a good developer understand the context they work in rather than try to fit a square peg in a round hole.

I wouldn't like to maintain Haskell code written by someone who thinks everything should look like Python. And vice-versa.

Re:Introduction to Object Oriented Programming in Python on Wednesday October 24, 2018 @01:35PM (#18294569)
I believe it started as a way to model real-world object. Simula was designed for simulations. But OO turned out to be useful for much more. The simulation use case mostly live on in tutorial and examples, spreading confusion to beginners.

But I also think the "message passing" metaphor has outlived its usefulness the same way. A caller does not need to know how the callee is implemented. Sure, but this is the same in any language with functions/procedure, this is not something specific for OO. The idea of message passing is a bit deeper, for example that the client does not even know it is calling a method. It sends a message, and the object answers, even if it is just by throwing an error that the message is not supported. This is how Smalltalk and (I think) Ruby works, but not at all how a statically types language like C# works. And it is not how Python works either. In Python you obtain a method reference from an object and then invoke it. So if you apply the message passing metaphor, your are actually passing the message to the method rather than the object itself. Which I think is just a confusing way to describe a method call.

I like removing superfluous punctuation, but if parentheses are removed from method signatures than they should also be removed from invocations, which in turn comes with its own set of readability issues. I'm not a fan of the $ operator in Haskell, for example.
Haskell does not have borrowing and lifetime specifiers though, which is what makes the Rust example more dense.
It is somewhat unfair to compare this to Python, since a lot of the simplicity in Python comes from the semantics (dynamically typed, garbage collected and so on). Rust need to express all this information (types, lifetimes etc.), so it will necessarily be more dense. The question is if this information could be expressed in a more readable syntax. This might be possible, but I would like to see a suggestion of how.

I guess the signature could be made more readable by using a few type aliases. The hardest part to read is the nested types.

I'm with you on the macro syntax, it is very hard to read. It is not easy to create a readable macro syntax though. All languages I know have hard-to-read macros, so this is not yet a solved problem.

What editor does not support indenting a block? In most editors I know you select the block and hit tab, or shift-tab to outdent.
Re:The Great Endumbening on Tuesday October 23, 2018 @05:07AM (#18281871)
So again a pet hypothesis which can explain both rising and falling IQ. So what observation could theoretically disprove this hypothesis?

Note that you can state exactly the opposite hypothesis and still claim the numbers support it. The use of gaming consoles and smartphones improve IQ, but this effect have maxed out in Scandinavia.

Re:The Great Endumbening on Tuesday October 23, 2018 @04:49AM (#18281793)
> The roman civilization used lead pipes for drinking water.

True, but the theory that this affected public health is a myth.

Re:The Great Endumbening on Tuesday October 23, 2018 @04:47AM (#18281788)
Amazing that the same pet hypothesis can explain both rising and falling IQ.
Re:The Great Endumbening on Tuesday October 23, 2018 @03:26AM (#18281432)
So why is IQ increasing in the US while declining in Northern Europe?
Re:The Great Endumbening on Tuesday October 23, 2018 @03:22AM (#18281413)
So why is this happening in Scandinavia but not in the US? Doesn't the US have just as many play stations and smartphones?
Django is not going to be rewritten in Julia. Neither is Linux going to be rewritten in Python. Different languages have different domains. Some of these comments seem to think all languages is competing in the same domain as if Rust is a direct competitor to Julia or JavaScript.
Rust will not steal Pythons dinner, they are used for completely different domains. The comment was saying that Rust might be a realistic alternative to C/C++/Fortran for modules which are not written in Python.
Good point about the learning curve. I don't think Rust is especially difficult overall, but you need to understand a lot before you get anywhere. Haskell kind of have the same problem, where you need to understand advanced features like monads before you can even write hello world.
Comparing Haskell to JavaScript is silly - JavaScript is popular because it is the only option in the browser. It has noting to do with the quality of the language itself. If VBScript had won, everyone would be using that. If Netscape had decided to use Scheme or Haskell as the scripting language, this is what everyone would be using.

Rust is competing in the space of C and C++, it is not competing against Java or Python. People are not gong to write operating systems in Python because it feels more productive. For simpler desktop applications you may have a point, but heavyweights like Word or Photoshop are written in C++ and Rust may be a realistic migration. JavaScript or Python is not.

PEP-8 (more than 15 years old) recommend spaces, so unless you are deliberately looking for a fight, the question is settled.

Autoindent is a solution to a problem that doesn't exist in Python in the first place. Having two independent representations for blocks, one for human readers (indent) and one for compilers (braces), leads to nasty bugs when they get out of sync. Autoindent is a tool to keep them in sync. In Python there is a single representation, so nothing can get out of sync.

You will see a lot of caricatures and ethnic stereotypes in Asterix. Primarily of European and Mediterranean nationalities though. A lot of the stories are Asterix and Obelix traveling to some region and all the stereotypes of that region is played up. If you are uncomfortable with this form of comedy, Asterix is probably not for you.
Re:Why Doesn’t Ancient Fiction Talk About Feelings? (2017) on Saturday October 20, 2018 @02:18AM (#18262022)
The Icelandic sagas certainly also portrays emotions. The characters are very much driven by emotions. The point is it is displayed entirely through their actions, not by internal monologue or direct description of their mental states like in 19th century literature.

Ancient lyrical poetry like Sappho on the other hand is direct expression of feelings. Ecclesiastes (in the Bible) is a monologue about the narrators feelings and mental state.

So it seems to more like a question of genre and narrative style rather than some kind of mental development of humanity. The sagas are not fiction, they are supposed to be about actual historical figures and events. You don't know what a historical figure actually thought and felt, only what they said and did. There are some examples in the sagas where characters directly express their feeling through poetry.

Re:This Old Lisp on Friday October 19, 2018 @08:10AM (#18256098)
I think the "I'm going to get downvoted for this..."-baiting leads to a lot of reflexive upvotes and downvotes regardless of the actual content of the comment.
Re:Asterisks in Python on Tuesday October 16, 2018 @03:29AM (#18227374)
Oh I know Go, just haven't used it for numerical tasks.

If Add(x, y) is just as maintainable as x + y, why does Go use operators for the regular numeric types? Why have + at all?

Re:Asterisks in Python on Friday October 12, 2018 @10:56AM (#18201820)
Is that really true? Sure you can write cryptic code using operator overloads, but the convention is to only use them in cases where they improve readability. For example numpy code would be a lot less maintainable without operator overloading IMHO.

I haven't written numerical code in Go but I am skeptical it will be as maintainable without operators. The lack of a particular feature does not in itself make code more maintainable.

I can't speak to metaclasses, since I have never had to maintain code using them. In my experience they are pretty rare.

Re:Asterisks in Python on Friday October 12, 2018 @10:47AM (#18201775)
Yeah that is what I meant, sorry for being unclear.
Re:Asterisks in Python on Friday October 12, 2018 @08:31AM (#18200948)
True, Python allows a lot of crazy hacks like monkeypatching, dynamically creating classes and so on. It is there if you need it. It is not like in Java where those things are simply impossible. The Python culture on the other hand discourages obscure hacks and unreadable cleverness, and the language is generally designed to encourage the straightforward and readable solution. I don't really see a contradiction in that.

You cannot prevent people from doing stupid things anyway. What you can do is encourage good style, and making the "right way" the path of least resistance. You can write readable code in any language, even Perl, if you use enough effort and discipline, but Python tries to make readable code the easy default.

The "quote" you made up is not representative of the Python culture or the article here, although I'm sure you can find some blogger somewhere with that attitude. They seem to have mostly migrated to other more hip languages though.

Re:Larry Wall's Very Own Home Page on Tuesday October 09, 2018 @11:24AM (#18176675)
A small-caps header made only with <font>-tags. From the time when web designers cared about the craft!
Re:Do we really live longer than our ancestors? on Thursday October 04, 2018 @02:23AM (#18137621)
That theory would assume the men from Adam to Noah are actually historical persons with recorded timespans, and there was just some mistake in interpreting the numbers. But consider that Noah is similar to a character known from much older Sumerian flood myths - except in the Sumerian version he is immortal. It is common to ascribe impossibly long lifespans to legendary figures from past ages - the Sumerian list of kings lists their early kings as having reign of tens of thousands of years.

I think it is a fools errand to try to find rational explanations for implausibilities in mythology. After all, the length of lifespan is kind of the least problematic thing about the account of Adam, if you want to understand it as historical.

Re:Disumbrationism, a Hoax Art Movement of the 1920s on Saturday September 29, 2018 @01:11PM (#18101500)
> The unfortunate reality is that a lot of so-called artists have absolutely nothing to say.

Well 90% of everything is crap. That said, I don't think the mark of quality is whether the artist have "something to say". What does that even mean? Most of art throughout history rehashes the same themes. The differentiator is not what they say but how they say it.

Consider that at one point blues and jazz was not considered "real music" by critics, and the same for rock'n'roll. Now people are studying these genres and writing academic papers. Does that mean they are all easily fooled dipshits?

Exactly. Things like sequels as also classified as adapted. Borat got a nomination for best adapted screenplay because it was based on the character from the tv-show. But the screenplay is supposed to be judged on its own merit, the academy members is not required to have read the book or whatever.
Re:Did Thomas Kuhn Kill Truth? A review of Errol Morris's critique on Saturday September 29, 2018 @03:34AM (#18099154)
I don't see the paradox though. The problem with the liars paradox is not the self reference itself, the problem is that the self reference leads to a contradiction. I don't see any contradiction the sentence presenting Kuhn's view.
> Most SQL systems provide a 1-to-1 mapping of tables

That is a bit weird criticism, since the whole point of relational databases is that the physical storage structure is abstracted away. SQL does not prevent databases from using different storage structures.

Older »