On Jan 10, 4:41 am, Radoslaw Bulat <radek.bu...@gmail.com> wrote:
> On Sat, Jan 10, 2009 at 11:09 AM, Robert Klemme
>
> <shortcut...@googlemail.com> wrote:
> >>> 2.) help(obj) -> <no brainer>
>
> >> Doesn't exist. Ruby does not have documentation metadata attached to
> >> objects.
>
> But it doesn't change situation for core/stdlib classes. Python's
> __doc__ is very useful, specially when someone is learning language
> and playing with it interactive shell. For Ruby I have defined method
> 'ri' in my ~/.irbrc file:
I must say that learning Ruby can be very painful at times. Python doc
strings, and help() function are lifesavers. I am trying to keep an
open mind, but i find myself beating my head against the desk at
times. :). Every language needs doctrings and some sort of shell docs
for new users. Ruby is not as noob friendly as it should be.
[Avdi]
You may notice a trend here - where in Python you sometimes use method
(obj) and sometimes obj.method() to find out about an object, in Ruby
it's *always* obj.method().
[/Avdi]
Python has a set of built-in functions like -- help(), id(), type(),
isinstance(), dir(), and many more. I rather like the way procedural
style is supported and scoping is handled. A noob can ease into OOP.
Don't get me wrong, i LOVE OOP, but forcing OOP on someone from the
beginning can be quite confusing. And besides there are many problems
where the OOP machinery just cannot be justified, and is overkill.
Procedural style lends itself to many problems in a simplistic way --
IMO -- and helps a new user navigate the language semantics in a more
strait forward way.