You are here

New server and code poetry

Hi!

Welcome to our new server, a blazingly fast 8 core Xeon 5520 with 24GB RAM. Don't tell anyone, but it's not running SLC5... Talking about OSes: Ubuntu Server is a really nice OS.

Fons managed to migrate all services; not easy given that we had to do a close-to-instantaneous switch. Now we can upgrade some of the services, e.g. phpBB2 will become phpBB3. Other than that you should not notice any difference. Let us know if something didn't come up properly!

Now for the second topic: poetry. I am implementing a buildbot continuous test for ROOT. It's all written in python. And I just cannot fall in love with it, no matter how hard I try. Python is slow, it can only judge whether I misspelled things at runtime, and it offers

pop()

but no

push()

- come on, what kind of a language is that!

 

But buildbot is still nice. And I have a proof:

    def giveUpHope(self):
        self.stillHopeful = False

If only I could write so intensely desperate yet beautiful lines...

Cheers,
 

Comments

Hello, Allex. If you want a separate step to check your spelling etc, as the C compilers do (because they must!), then I suggest you look at various tools like PyChecker or pylint. These tools must be run in a separate step, but then so must the C compiler. So no additional user cost is incurred versus using C to gain (or regain) this minor benefit of separate-compile-step languages.

Hi,

Thanks for your comment! I am aware of these tools. They cannot, though, do the same level of checking as is possible in e.g. C++, simply because python allows for much (much!) more dynamic runtime behavior than C++. I.e. in most cases, expressions could become legal. So it's not a question of tools (and compilers are not just there to check code - you get native binaries in the end!) but inherent to the language.

That said: thanks for mentioning these tools, I agree that they definitely do help!

Cheers, Axel

Try C#. It has all powers that python has. But C# is ten times faster, has all design time code checks and also have all push-es one may need. Shurely, I'm speaking a bit ironic. I understand that probably you use python due to unbreakable circumstances... (Like no alternatives). But... Bah... I'm almost one and half year trying to fall in love with python and can't! Why do I need all this dynamic crap if it only makes things slower and harder to check if a good designed static language (like C#) can provide ALL it's possibilities, but have a very clear syntax, very good speed?

Hi Axel,

If you want a separate step to check your spelling etc, as the C compilers do (because they must!), then I suggest you look at various tools like PyChecker or pylint. These tools must be run in a separate step, but then so must the C compiler. So no additional user cost is incurred versus using C to gain (or regain) this minor benefit of separate-compile-step languages.

Regarding push and pop, I take it that you want a stack data structure? It might be worthwhile to glance at http://docs.python.org/tutorial/datastructures.html#using-lists-as-stacks, although I expect you've already seen that. If you dislike saying "append" when you mean "push", it is pretty trivial to produce an alias for the append method named push. This might seem kludgy, but I would then point out that even the STL only offers std::stack as a wrapper around the more fundamental sequence types, so there is really no non-trivial difference here.

I don't want to try and be a pushy python advocate, but if I can help you fall in love with a new language, then you can add another tool to your toolbox, which can never be a bad thing! Regards, Jon

Hi Jon!

Thanks for your comments! I decided to use a "proper" collections.deque in the end which does everything I want, except for offering push() :-)

Buildbot comes with a check for its python-based configuration. That can by design only find syntax issues. Have a look at the interesting presentation by a Google employee / Unladen Swallow developer Unladen Swallow: Python on LLVM at the 2009 LLVM dev meeting. Better watch the video which explains much better than the slides what the problem is: in python, a variable x can in one line be of type A, in the next line it can be dynamically changed to type B. No syntax checker in the world can find it: this must be evaluated at runtime, and it's one if the major problems when trying to optimize python in any way. So this is inherent.

That said: I just ran sudo apt-get install pylint (what an impressive set of dependencies :-). I had heard about it before but I was always afraid to use it. Now I know why: it's brutally honest :-) Thanks a lot for the recommendation!

And don't worry, I am writing python since years, and it's good for many things (just like Bash, Perl, PHP and all the others). But love, that goes someplace else :-) Cheers, Axel.

Hi Elliott,

thanks for your comment! While you're right on the syntax checks, I double that any IDE can do proper code checking. The problem is inherent to the design of the language: its variables can be of any type. That's both the power and the pain of python. I wouldn't know how an IDE could (even theoretically) determine what type a variable (e.g. a parameter) has.

Cheers, Axel.

Hi Axel, Got to know about ROOT library today. Great one. But I feel, the home page nor the site doesn't actually say what exactly is ROOT. I had to google it, which redirected to the same site. Finally checked it on wikipedia, disambiguate it, to know what exactly is ROOT. Hope we can see a brief description of it on the home page. Cheers, Sandesh.

Hi Sandesh,

Thanks for your comment! And thanks for trying out ROOT! I'm sorry I only reply so late - I will become more active with that blogging again :-)

I hope that what you were looking for can be found by clicking "About" in the front page of ROOT, i.e. at http://root.cern.ch. Now the question is: why didn't you find that? I assume it's because we're all used to the Windows-style menu bars: if they have a sub-menu you cannot click the parent item. Could that be it? If so: that's definitely something we can work around, e.g. by adding the parent item to the submenu.

Cheers, Axel.