All the data stored in a Python program is built around the concept of an object. Objects include fundamental data types such as numbers, strings, lists, and dictionaries. It’s also possible to create user-defined objects in the form of classes or extension types. This chapter describes the Python object model and provides an overview of the built-in data types.
python is a beautiful language – with only one major ugly problem – namespace pollution. even the texts and guides expect you to “import from” into the main namespace… ugly and bad practise.
python needs a better way of handling this. top level names should only be the core set of language keywords (for, if, def,..) and anything else should be structured and unambiguous and unable to clobber anything else. if there are function name lookup issues, as described in the article, that is an implementation issue, not a language design issue. you can cache the name lookup if you like….
How is what Python does any different than the using statements from C++?
i don’t know C++ so i can’t answer. however both python and C++ provide means by which namespaces can be kept isolated and managed… but it is not enforced. that is my understanding.
yeah… and no production language that is in wide deployment enforces namespaceing isolation (well… Java does, but Sun made tools to make it less crappy, and java got mind share because it was the first “compile once run anywhere” buzz phrase language so corps saw it as a way to give themselves out of lock in.
Is not a problem if you know how to handle it. You are not required to “from foo import bar” , it’s pure lazyness. But if you know you are not using bar in your code, or any other module with name bar, then it’s ok to use it that way.
Programmers are smart (generally) people, unlike most users. They know their language and its shortcuts. Why is that bad?
its bad because programmers are human and humans make mistakes or oversights and get tired. convenience can be provided by IDEs like eclipse and netbeans… as they already do for Java.
Edited 2006-03-20 15:31
I don’t see Java as successful as Python, with all its conveniences. Even C with its global namespace achieved great things, more than Java did. You know, academic languages are just for teaching. Real world requires Perl, Python, C, C++ and PHP.
yeah… who uses java?
Come on… I don’t really like Java and all but, saying that it is just a language for “teaching” and that the “real world” doesn’t use it is a little naive, at best.
The enterprise world has its head sunk on Java for some time now… at least on my part of the world.
just my R$0,02 (Two cents of ‘Real’)
“Real world requires Perl, Python, C, C++ and PHP.”
What part of the world do you live in? Pretty much every IT department in the world worth their salt uses either C++, Java or .Net (ColdFusion has a huge presense as well) for application development. PHP is a complete joke outside of building small hobbyish websites. You might see a bit of Python/Perl for gluing stuff together, but I’ve only seen it used in edge cases. C is only used for OS/driver development. Welcome to the real world.
“Pretty much every IT department in the world worth their salt uses either C++, Java or .Net (ColdFusion has a huge presense as well) for application development. ”
What part of the world do you live in? Pretty much every IT department worth their salt uses either PHP, Perl, Python or .Net/ASP. C++ is a complete joke outside of building small hobbyish websites.
Edited 2006-03-21 08:03
I live in the real world of corporate IT.
I’ve never seen a reputable IT dept use PHP for anything. It has its place, but corp IT isn’t one of them. C++ would never be used for a web application (well, maybe ATL if they were very ambitious (and there was an EXTREME need for performance), but .Net would get comparable performance at a fraction of the dev time), but is still the de facto for mission critical non-web based apps where pure performance is the driving factor and the stakeholders have the funds to dole out for the extra time it takes to write apps in C++. Perl and Python? Perhaps for small apps, but these languages are used more as glue to tie larger apps together and are not used to build an entire application…not in IT at least.
The point is that corp IT depts employ very strict guidelines surrounding what frameworks can be installed on servers/workstations. They almost always go with professionally supported environments, like Java and .Net (and the various C++ compilers) so that if anything breaks, they can be guaranteed a fix.
“I live in the real world of corporate IT.”
So do I, yet my experience is entirely different.
Oh well, that’s how it is.
“so that if anything breaks, they can be guaranteed a fix.”
I think you mean “so that there’s an outside scapegoat to pin the blame on” since rarely is a fix “guaranteed”.
Yeah, I guess that’s how it is. I still stand by my original post though…companies want guarantees that if something goes wrong, there’s a formal channel to fix it.
In an effort to keep this civilized… 😉
By using frameworks that are backed by companies (in this case Java/Sun and .Net/MS), if something goes wrong it isn’t about finding a scapegoat, it’s about getting the issue fixed. Period. Placing blame has no place in the workplace, who cares who broke it…just fix it. Both of these companies are very good to their customers if either A) the bug is due to something the customer has introduced or B) the bug is due to something in the framework itself.
If a mission critical system writtin in [insert some OSS language here] goes down, a fix is needed ASAP. With formally supported platforms (regardless of the cost to fix it, this should be part of IT’s budget) this would be a matter of hours. With OSS languages, it could potentially take days (and there aren’t any formal lines of support), which is unacceptable in the IT realm. In IT, downtime == monetary loss.
Placing blame is secondary to getting the root issue fixed (actually placing blame should never happen period…mistakes happen). Companies want reassurance first and foremost.
“Placing blame has no place in the workplace, who cares who broke it…just fix it.”
You are blessed with sane middle-management
Lol, considering I have been middle mgmt (which I hate, but it’s a natural career progression unfortunately…bleh) on some projects, I’ll take that somewhat as a compliment.
In the end it really isn’t about singling who’s fault it is. Stuff just needs to work…if it gets broken, get it fixed ASAP. If “blame” needs to be placed, that gets figured out later on. It’s not about the language/platform being used, it’s about the end result.
Articles like these are nice to read but you could replace Python with any modern OO language and pretty much have the same thing. Each has it individual quirks it seems. I am not a developer – I am a Chemical Engineer. And I wonder what the pros/cons of using Python vs. Ruby vs C# vs Java really are. I mean, I think it would be very nice if someone could put together an article about when to use each, their strengths, and why someone like myself who might use programming to extend his core business should spend time developing with one versus another. I am at a point where i believe that Realbasic might be the best overall language right now. It is a modern OO tool that is cross platfrom. How can that no be an optimum situation? Help me understand!
Python v. Ruby ? basicly which ever syntax you enjoy the most. I like Python’s ways of doing a lot of stuff over Ruby’s, so I chose Python.
Python v. C#/Java? well… then you are talking the diffrence between an interpreted langauge verses a compiled language (java and C# get compiled to bytecode before tehy can run, even if you run it in a JIT) plus you have other issues like data typing rules and object models, etc.
Python vs. Ruby:
My experience is that Ruby is super consistant. When they say OOP, they mean it. It would take awhile to illustrate that, but if you want to compare Ruby to something, compare it to SmallTalk.
I like both Python and Ruby. I’ve used Python more and only played with Ruby. So, I tend to gravitate toward what’s familiar (Python). But, Ruby rocks.
Both of these platforms will run almost anywhere. I think Mac’s install both by default.
C# vs (Python and Ruby):
C# is for all practical purposes, only available on Windows. Yes, I know about Mono. I’ve been dabbling with C#, as my job requires it. It’s nice and I’d recommend it for a large project where portability was not a concern. But, if you just want to do some regex, I’d still prefer Python and/or Ruby (probably Ruby for regex since it borrowed a bunch from Perl, which is King of regex).
This is coming purely from a corporate IT perspective, and it’s actually quite simple.
If you’re targeting Windows, it’s a no brainer…go with .Net. If you’re targeting anything else, use Java. Most of the systems I’ve worked on are usually Windows on the frontend/application servers (i.e. asp.net on IIS, or winforms clients), and the backend stuff (database servers) varies widely. If the backend isn’t a Windows machine (i.e. you need a big iron Unix box to run Oracle or something), program the backend in Java. A lot of companies also use JSP for intranet sites, so of course you’d use java there (though asp.net is catching up rapidly). Java’s main strength (outside of the language itself, which is always debatable) is that it can run on Unix…so if you need the power of Unix it’s there.
VM’s aside
Java, C# : statically strong typed langs
Ruby, Python : dynamically strong typed langs
Some smart people are starting to thinks that this dynamic langs are more productive (and I agree…but hey! I eat thanks to all this Java & J2EE stuff)