import os as realos Names are nothing magic in Python, and quite easily manipulated:
import os os.write(1, "Hello World!") class os: pass o = os() import os os.write(1, "\n") So basically this kind of name clashes usually do not happen in Python. Or another usage: os = SomeObject() def function_that_needs_real_os(): import os print os.getuid() Am Freitag, den 01.07.2005, 15:38 +0200 schrieb Adriaan Renting: > Adriaan Renting | Email: [EMAIL PROTECTED] > ASTRON | Phone: +31 521 595 217 > P.O. Box 2 | GSM: +31 6 24 25 17 28 > NL-7990 AA Dwingeloo | FAX: +31 521 597 332 > The Netherlands | Web: http://www.astron.nl/~renting/ > >>> Tom Anderson <[EMAIL PROTECTED]> 07/01/05 2:50 PM >>> > >On Fri, 1 Jul 2005, Adriaan Renting wrote: > >> I'm not a very experienced Python programmer yet, so I might be > >> mistaken, but there are a few things that would make me prefer C++ > over > >> Python for large (over 500.000 LOC) projects. > > > >Hmm. I don't know C++, but here goes ... > > > >> - namespaces > > > >Aren't namespaces basically the same as packages/modules in python? > > > Not in the way C++ uses them. In Python if would be something like this: > --------------------------- > import os > using namespace casa > class os: > def open(self, file): > pass > a = os.open('something') > b = std::os.open('something') > using namespace std > c = casa::os.open('something') > d = os.open('something') > --------------------------- > This is a realy stupid example. It's essentially an extra hierarchy > layer to avoid naming clashes. I don't know of a way to do this in > Python, how would you do this? > > >> - templates > > > >These would be meaningless in python - they're part of typefulness, > which ... > > > >> - strong type checking > > > > > >Not that this is necessarily a good thing. I have to say that my Java > >roots do lead me to think that strong typing is a plus for big > projects, > >since it's a way of defining and enforcing interfaces between bits of > code > >written by different people (or by one person at different times!). > >Optional static typing in python would be nice for this. > > > Exactly what I my point is, see also my other post on this (the LOC > post) > > >> - data hiding > > > >Surely you can hide data in python? > > > Again, how? Is there a way to force that an external user of my lib can > not use my internal data/methods/classes, unless he uses odd compiler > hacks? > > >> - more available libraries and more advanced developement tools. > > > >True. The more advanced development tools are offset to a large degree > by > >the advanced crappiness of C++ as a language, though; i'd be surprised > if > >a C++ programmer borged up with all the latest tools was actually more > >productive than a python programmer with a syntax-colouring, > >auto-indenting text editor. It'd be very interesting to get some real > >numbers on that. > > > I think my point is: I would be, for large projects. Just comparing my > Borland C++Builder experience with my Eric3+QtDesigner experience. This > is not only because of differences between C++ and Python though, a good > IDE alone can make 50% difference but that's another subject. > For small simple projects where I am familiar with the libs I need, I > think I'd prefer Python. > > >>> Ultimately, manageability of a project is far and away more about > the > >>> people involved and the techniques used than it is about any single > >>> technology involved. > >> > >> Agreed. > > > >+1 getting to the crux of it. > > > Thank you > > >tom >
signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil
-- http://mail.python.org/mailman/listinfo/python-list