LWN.net Logo

Offtopic: Python

Offtopic: Python

Posted Aug 15, 2008 3:14 UTC (Fri) by dmag (subscriber, #17775)
In reply to: Offtopic: Python by ikm
Parent article: Chandler finally reaches a 1.0 release

"If it was in C++, bah, you get compilation error immediately. But in Python the program would happily work ever after, until some day the thing would finally go there and explode."

I must assume that you ship your programs as soon as they compile. Because if you run your program (even just once) to see if your new code really works, then you can't complain because that's what the scripters have to do too.

"The whole idea of the scripted paradigm, as I understood it, was to have more code in less time. I don't like how it turns out in reality, though, because what we have as a result seems to me to be more like "more code done by less competent people"."

Non-sequitur. Sorry, you failed to make a logical argument.

"But I'd rather have a program done by a pro, a program which is fast and bug-free and consumes less resources at the same time"

Me too, but what does that have to do with programming language? Speed (and resources) are usually proportional to the algorithm you use. Bug-free is proportional to the amount of testing you do and/or the smarts of the designer.

Back on topic:

I actually downloaded Chandler and tried it. The application is not snappy, and makes me think I'm using a web application because screen updates take time. Also, their UI needs to be re-thought: It assumes you always want to copy items instead of move them to new categories. If you create an item and immediately delete it, you'll later find another copy in the "desktop" view.

I could see how some people would live with it and it's warts. But I'll skip it for now.


(Log in to post comments)

Offtopic: Python

Posted Aug 15, 2008 10:17 UTC (Fri) by rwmj (subscriber, #5474) [Link]

I must assume that you ship your programs as soon as they compile. Because if you run your program (even just once) to see if your new code really works, then you can't complain because that's what the scripters have to do too.

The poster was referring to code paths which aren't exercised in normal use. 'foo.bar()' is on some rarely used error path, and it's not possible to completely test all paths through your code. That's why the compiler ought to be picking up these errors for you, rather than relying on very extensive yet incomplete test suites. Not that having a test suite is a bad thing, but no one can object to the compiler finding even more bugs, as early as possible in development.

Speed (and resources) are usually proportional to the algorithm you use.

Yes, but Python also suffers from a 10-fold disadvantage in speed and resource usage, even when the algorithms are identical.

Rich.

Offtopic: Python

Posted Aug 15, 2008 14:33 UTC (Fri) by k8to (subscriber, #15413) [Link]

Speed, certainly, resources hardly.

Offtopic: Python

Posted Aug 15, 2008 17:03 UTC (Fri) by mosfet (guest, #45339) [Link]

There are solutions on the horizon to get Python execution speed comparable to C or C++. Have
a look at the PyPy and LLVM projects.

Offtopic: Python

Posted Aug 15, 2008 17:05 UTC (Fri) by drag (subscriber, #31333) [Link]

> Yes, but Python also suffers from a 10-fold disadvantage in speed and resource usage, even
when the algorithms are identical. 


Quite frankly that irrelevant. It really is. It doesn't seem like it at first, but it is. 

Why?

Because the vast majority of a program isn't speed sensitive in any sense of the world. Only a
small amount of most programs consume the vast majority of resources the program uses.  And
because of the nature of programming it's often very difficult to determine which parts of the
programs are going to be the troublesome part.

(Now, of course, the following does not trump good programming design or performance oriented
thinking.. in fact it augments it.)

So when you program in python and you reach a point in your program which performance becomes
a serious issue, so that figuring out better algorithms in python isn't going to get you
better performance, then you have to hunker down and rewrite the troublesome parts in C and
import it back into your program as modules. 

And, since, there is a number of different ways to do this that makes it easier then it used
to be.. Such as programming in python-C hybrid languages like Cython or Python.. AND you've
already done the hard work of designing better algorithms in a higher level language then
you'll likely end up with better performing code then if you started off programming in C in
the first place.

That is the key to having very complex python applications that perform very complex things is
to not program everything in python.

Python isn't like Java were everything needs to be java-this or java-that. It's quite happy
integrating with other languages. So you use what is appropriate.


--------------------------------------

A case in point:

Git is a example of a program that uses lots of high level languages and is very good
performing. It does not use any python, but it does use a large amount of Perl and bash shell
code. 

Given that Perl is slow, and shell scripting is not only extremely slow.. it is very very
limited in what it can do, then that means that Git should be very slow and limited, right? 

Well no. Of course not. 

Git not only is faster, it's magnitudes faster most any other RCS (for the features that the
designers care about). Many that have been written in C++ and don't use any shell or perl. And
they've done that in less time and effort then what other RCS have benefited from.

--------------------------------------

Given infinite amount of time, skill, and resources C++ will always be a better choice then
Python. No question about it.

And given infinite amount of time, skill, and resources C will always be better then C++, and
in turn Assembly will always be better then C. 

(since C was originally written in assembly, and C++ was written in C, then nothing that is
done in C++ can't be done in C, and nothing that can be done in C can't be done in assembly.
And, of course, the reverse is not true.. Assembly can do things that can't be done in C, and
C can do things that can't be done in C++.)

None of us have infinite resources and infinite skill.

----------------------------------------


The theory is that using high-level language isn't going to just allow you to crank out more
code quicker. The theory is that it allows you to crank out _better_quality_ code more
quickly.  (But I can't tell you for certain that is true. I just don't have that much
experience.)

It is not a crutch for lack of skill, like many people treat it. In fact you still have to be
very aware of everything from the hardware on up if you want to have quality software.

What I can say is that I've used plenty of python things that were faster then plenty of C++
things, even though that's usually not the case. Generally they crash much less and don't have
memory leaks, which is usually the case.

*shrug*

Offtopic: Python

Posted Aug 15, 2008 17:06 UTC (Fri) by drag (subscriber, #31333) [Link]

> Such as programming in python-C hybrid languages like Cython or Python

Oops. I meant Cython and Pyrex

Offtopic: Python

Posted Aug 15, 2008 18:15 UTC (Fri) by rwmj (subscriber, #5474) [Link]

I seem to have touched a nerve there. I now program almost entirely in OCaml, which gives me the real world stuff (loads of libraries etc), performance very close to C, low memory usage, proper error checking in the compiler, terse code, rapid development, etc. etc. In other words, all the advantages of Python, plus the advantages of modern languages, without having to wait for some far-off LLVM project to make Python fast.

Rich.

On topic: using collections, not mis-understanding the dashboard

Posted Dec 19, 2008 8:55 UTC (Fri) by grahamperrin (guest, #55680) [Link]

> their UI needs to be re-thought: It assumes you always want to copy
> items instead of move them to new categories. If you create an item
> and immediately delete it, you'll later find another copy in the
> "desktop" view.

Correction: _you_ assume that you always create items in the dashboard.

This is not a criticism, I do understand your misunderstanding of the UI ;)

Clarification:

1. select (click) a collection
2. create a note, within or without the calendar.

Result:

You will _not_ later find another copy of your item in your dashboard.

----

If you later copy something from a collection to your dashboard, it will remain in your dashboard
for as long as you want it in your dashboard.

I suspect that for some newcomers to Chandler Project:

* Chandler Hub is a more graceful introduction than Chandler Desktop.

The Hub encourages (currently, forces) users to think in terms of collections.

I will make my suggestion to the chandler-users list.

Everyone: re http://chandlerproject.org/mailinglists#TableOfLists please note that you may
address the list without subscription.

Kind regards
Graham

My misunderstanding! But thought-provoking

Posted Dec 19, 2008 9:05 UTC (Fri) by grahamperrin (guest, #55680) [Link]

I am wrong!

Sometimes it helps to think aloud (write) before I realise such things.

Indeed, this behaviour is interesting.

My first guess:

* it's not usual to delete some thing.

More usual:

* change the nature of the thing.

Changing its nature may be:

* triage to: done
* triage to: later
* add to calendar, or remove from calendar.

Let's rewind.

Q: Why did you create the item? (If it wasn't a note, task, event, whatever, then what was it?)

The question of most relevance:

Q: Why did you immediately delete it?

Reasons for immediately deleting something

Posted Dec 19, 2008 9:09 UTC (Fri) by grahamperrin (guest, #55680) [Link]

In testing: I might wish to immediately delete some thing that is not real.

In real life: I add real things to Chandler.

I suspect that this workflow issue is perceived only when working with items (notes, events, tasks,
whatever) that are for test purposes, not for real.

If what you entered in Chandler was a passing thought, worthy of noting, even momentarily:

* allow yourself that thought.

Your thought was real. In Chandler, mark your note of that momentary thought as:

* done.

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds