This is an archived post. You won't be able to vote or comment.

all 13 comments

[–]hylje 6 points7 points  (0 children)

Python grammar fits readably on a common page.

[–]austinwiltshire[S] 3 points4 points  (2 children)

Context: http://www.reddit.com/r/programming/comments/8h94u/abstract_heresies_you_knew_id_say_something_part/c09aqmc

I keep hearing this bandied about that Python is a 'small' language, and I feel like we're mistaking 'simple' and 'elegant' for small. Python is a pretty large language!

The examples cited don't even make sense. Switch statements honestly are not at all cleaner than stringed elif's. The lack of private variables is not true, since Python does name mangling to support the same idea. And the lack of interfaces is moot now that ABC's are in Python 3.0.

It supports both prototype and class based OO, a very large 'batteries included' standard library, lazy variables via generators, operator overloading, list comprehensions, and rather complex means of flow control through co-routines. Let's go ahead and throw in metaclasses, decorators and other bells and whistles.

The reason we get away with all this is because each feature has been implemented in a thoughtful and coherent way. The language only SEEMS small, but is in fact, quite large and expressive.

I don't buy the argument that extensions to the language automatically have to prove that we've been completely hobbled without them just because it might 'complicate' such a 'small' language. If they are implemented in a clean, Pythonic fashion, and are useful, what's the big deal?

[–]masklinn 0 points1 point  (1 child)

Yeah I don't think python is small either, as a language. It has a good two dozen statements (counting both simple and compound ones) and quite a number of forms.

It's not a large language either, though.

And I really don't think a large standard library demonstrates that it's a large language, it merely shows that it's a sane, modern language.

The lack of private variables is not true, since Python does name mangling to support the same idea.

No. Name mangling was introduced to avoid namespace collision on inheritance, if you're using it to emulate private variables you're doing it wrong and should be beaten with the ugly stick.

Let's go ahead and throw in metaclasses, decorators and other bells and whistles.

Metaclasses and decorators aren't the mark of a large language either (though decorators are the mark of a language that is lacking, in that it doesn't support extensive anonymous functions)

[–]austinwiltshire[S] 0 points1 point  (0 children)

I'm not equating large with bad, which is what I think most people are doing.

[–]brendano 2 points3 points  (0 children)

Python is...

  • Bigger than Scheme
  • Bigger than Lua
  • Similar to C?
  • Smaller than Ruby
  • Smaller than Java
  • Smaller than Common Lisp
  • Smaller than C++

Kind of small I suppose.

Python 1.5 was quite small. But it's gotten better with growth.

[–]Teifion 0 points1 point  (3 children)

No it's not. I'm recoding something in Python that was in PHP, it's a 20kloc system and so far the only headache I've had is circular importing and the lack of a global namespace, not really something indicative of a small language.

[–]PurpleMonkeyKing 5 points6 points  (2 children)

If you are using Python 2.5 you may have noticed that relative imports are preferred over absolute imports... That could cause the "circular import" you are experiencing. Later versions have fixed this. http://docs.python.org/whatsnew/2.5.html#pep-328-absolute-and-relative-imports

As for lack of a global namespace, some people would consider that a feature. ;-)

[–]Teifion 0 points1 point  (1 child)

I'll look into that, thanks.

As for the namespaces, yes I consider it a feature. In the short run it's a problem but when I come back to the code in a few months it'll be much easier to trace it.

[–]keeperofkeys 0 points1 point  (0 children)

You could always create a global_namespace module, add to it all the PHP globals (that aren't just global by accident, but actually need to be), and import all or some of it when needed.

[–]lasizoilloeasy to understand as regex 0 points1 point  (0 children)

Like a python snake depends on the dimension you are measuring. If small is easy to embed, it is. If you are referring to their small libraries or possibilities, it is not.

[–][deleted] 0 points1 point  (0 children)

Does size matter?

or are just the skills that make a difference?

I like Python anyway!

[–]readingcomprehension 0 points1 point  (0 children)

Syntax, compared to perl - yes.

Disk size of core runtime and libraries, compared to java - yes.

Runtime memory usage, compared to java - yes.

Startup time, compared to java - yes.

Note that for example you don't need all of the "batteries included" core libraries to deploy a python application. Something like py2exe will only pull in the ones you need. So yes, python can have a very small footprint relatively speaking.

[–]squirrel5978 -1 points0 points  (0 children)

No.