Python

Pages: 123
closed account (1yR4jE8b)
Holy shit, I just read about that Dynamic type in Scala. I've used Scala before but never heard of that. Pretty awesome, I'm not sure where I would use it off the top of my head but I have to say Scala really is an amazing language.

Why not?

Library support. Do the bindings exist? Are they usable, under active development etc...
@darkestfright: The point about indentation is not that the error is easy to find. The point is that the error itself is unnecessary. As for the code you wrote, IMO stuff like this shouldn't even be possible and I wouldn't write it that way. I think whitespace indentation just introduces an unnecessary source for errors. It doesn't matter how fast you can fix it, it's still just unnecessary. It doesn't take that much time to write brackets. IMO it's just something where the Python designers went too far with the whole "we're gonna make this more readable" thing. But you're right, it's a matter of oppinion. And my remark about brackets being more obvious was more meant in the sense that when you read your code before executing it you are far more likely to miss a misplaced whitespace then to miss a missing bracket.

I don't understand what the big deal about white space is. Most editors (at least I know Emacs does) and IDE's auto indent for you, and even if they don't you just have to press tab and... voila! I don't find that it affects readability either. While I prefer brackets because they were what I first learned, I don't think python-style indentation is a problem.

The point about indentation is not that the error is easy to find. The point is that the error itself is unnecessary.

You can make the same point about braces.
Last edited on
closed account (1yR4jE8b)
+1 ascii

As for the code you wrote, IMO stuff like this shouldn't even be possible and I wouldn't write it that way.


It shouldn't be possible, but it is. I would never write code that way (unless for an example like the one I posted), but that doesn't mean that someone else won't. I've worked on some open source projects with over 100 contributors, you'd be suprised how often awful looking hacks like what I posted are committed into a stable branch.
I guess Python mandatory indentation will remain to be debated for years to come but for me personally, I do find it too rigid. Besides most modern text editors when we hit enter it is auto-indent already. So I still think C/C++/Java etc of using a curly brace is more practical.

Of cuz I am not letting that indent issue turn me off from Python. In fact I did brought up Python as possibly a *good* interpreted language in this forum. I was thinking if it can replace Perl which is *notorious* for their almost anything is acceptable syntax.
closed account (1yR4jE8b)
Besides most modern text editors when we hit enter it is auto-indent already. So I still think C/C++/Java etc of using a curly brace is more practical


Wouldn't it be more practical to have automatic indentation for Python then for C/C++? Because then you don't have to type *any* additional characters, only backspace when you want to exit that scope.
Depending on what kind of text editor you have, you can have one curly bracket, one enter and then cursor move to the next line with indent and even the ending bracket pre-filled in also.

Please note I know this indent issue with Python will go on and on so I would rather we discuss on Python other merits instead. In particular I like the built-in data type like list, set etc woahhh you use them like primitive type. This is very ideal in computer science algorithm implementation.
I think i'll throw Go Lang into the ring of languages with a mandatory coding style.

Last I used it, a program written in Google Go would not compile if an opening bracket was not on the same line as the code it is related to.

so
1
2
3
func main() {
    fmt.Printf("Hello, world; or Καλημέρα κόσμε; or こんにちは 世界\n")
}

Will compile, while
1
2
3
4
func main() 
{
    fmt.Printf("Hello, world; or Καλημέρα κόσμε; or こんにちは 世界\n")
}

will not.
Last edited on
closed account (1yR4jE8b)
That is pretty awful, pick one or the other...not both.

I think one of Python's greatest merits as a scripting language is being able to write sysadmin scripts that are cross-platform.

For example, I develop on Windows but one of my colleagues develops on Linux. So instead of writing .bat and .sh files for each OS, we just write python scripts and if worse comes to worse and we need to do platform specific stuff we just do something like:

1
2
3
4
5
6
#do cross platform stuff here
if sys.platform == 'win32':
    doStuff()
elif sys.platform == 'linux2':
    otherStuff()
#more cross platform stuff 
Last edited on
I believe Perl has a longer history than Python and it was already a scripting language used to write sysadmin scripts that are cross-platform. So the contention would be more of Perl vs Python instead?
closed account (1yR4jE8b)
I really like Perl -- it was one of the first programming languages I learned while learning the Unix operating system -- but almost entirely as a historical figure. I would never use it in production code today. Python and Ruby (and the latest batch of other dynamic scripting languages) are really just the next logical evolution of what Perl started. In a few years, we'll see stuff which supersedes Python and we'll be having the same argument Python vs. "that language".
C# all the way for me :P
I do all my sysadmin scripting in pure, unadulterated machine code. I feel the inherent boost of speed it gets from hand optimizing outweighs the time it takes to rewrite each program for every piece of hardware I work with.

Edit: Forgot to mention, all the code is entered via punch card. High Level languages like assembly will never give you the raw power that you need like machine code can.
Last edited on
Punch cards? And you call yourself a programmer? Young'uns. They'll never know the sheer inherent beauty of switching out machine parts to make your programs.

-Albatross
Hard drive? /desk

Like I said. Those young'uns will never know the sheer inherent beauty of a computing world in which the distinction between hardware and software is blurry. Now, who wants cookies?

-Albatross
Good Ol' C-x M-c M-butterfly

I knew that one was going to be linked before I started typing.
that a great idea
Topic archived. No new replies allowed.
Pages: 123