Is Python overhyped (just like Java)?

Duncan Booth duncan at NOSPAMrcp.co.uk
Tue Apr 1 10:03:22 CEST 2003


Thomas Bellman <bellman at lysator.liu.se> wrote in 
news:b6aam1$7o6$1 at news.island.liu.se:

>> I've heard C++ guys bash Python as not 
>> object oriented because Python doesn't support private data.  "You mean 
>> I can bypass the accessor functions and touch an object's data 
>> directly!?"
> 
> Of course, that is possible to do in C++ too.  I would even contend
> that it is actually *easier* to do so by mistake in C++ than in
> Python; but it is easier to do so willingly in Python than in C++.
> (And here is a hint for those that don't believe it can be done in
> C++: pointer arithmetics.)

I found '#define private public' before including the header file worked 
for me and was less messy than pointer arithmetic. (Pedants may wish to 
point out that this isn't guaranteed to work, but in the particular case 
where I had to do it, it worked just fine.)

-- 
Duncan Booth                                             duncan at rcp.co.uk
int month(char *p){return(124864/((p[0]+p[1]-p[2]&0x1f)+1)%12)["\5\x8\3"
"\6\7\xb\1\x9\xa\2\0\4"];} // Who said my code was obscure?




More information about the Python-list mailing list