[BangPypers] Object Oriented Programming in python

Dhananjay Nene dhananjay.nene at gmail.com
Mon Oct 21 11:51:37 CEST 2013


On Mon, Oct 21, 2013 at 3:02 PM, Saager Mhatre <saager.mhatre at gmail.com> wrote:
> On Oct 21, 2013 12:09 PM, "Dhananjay Nene" <dhananjay.nene at gmail.com> wrote:
>>
>> On Mon, Oct 21, 2013 at 11:53 AM, Saager Mhatre <saager.mhatre at gmail.com>
> wrote:
>> > On Oct 21, 2013 11:39 AM, "Dhananjay Nene" <dhananjay.nene at gmail.com>
> wrote:
>> >>
>> >> On Mon, Oct 21, 2013 at 10:55 AM, Saager Mhatre <
> saager.mhatre at gmail.com>
>> > wrote:
>> >>
>> >> > Which generally lead to poor (or at least poorer) abstractions; but I
>> > digress.
>> >>
>> >> Leaky ??  :)
>> >
>> > For the most part, yes.
>> >
>> >> >
>> >> >> I think OOPs concepts across a number of languages are quite
> different.
>> >> >> You will find python having superior constructs eg. metaclasses etc.
>> > if you were comparing Python OOP to C++/Java.
>> >> >
>> >> > Superior constructs implemented inferiorly. Meteclasses are much^3
> more
>> > powerful in Groovy, Ruby and SmallTalk (where some would claim Python
>> > borrowed them from; but that's just not true.)
>> >>
>> >> I wonder if you meant syntactically/stylistically. Would be keen to
>> > learn, if there are examples where ruby / groovy (I don't know much
> about
>> > smalltalk) allow things that python does not.
>> >
>> > Semantically! MetaClasses are a much more powerful construct in those
>> > languages.
>>
>> I'm specifically looking for evidence to support that. And I suspect
>> it might be out there to be found , just that I haven't so far. One of
>> my early attempts was documented here
>>
> http://blog.dhananjaynene.com/2010/01/dynamically-adding-methods-with-metaprogramming-ruby-and-python/
>>
>
> Don't look for metaprogramming, you'll end up with a lot of ancillary
> stuff. Look for metaclasses or metaobject protocol.

Is there an example or two which demonstrates ruby can do things via
metaprogramming / metaclasses / metaobject protocol that python cannot
? Something more than syntactic or stylistic differences.

It wouldn't be normally fair for me to ask for that and I should go
hunt it down myself, but given the earlier assertions made in this
thread, i believe it is reasonable in this case.


More information about the BangPypers mailing list