An assimilators guide to Python?

Hi!

I now and then come across Python and Perl programs with permitting
licenses that seemingly contain code I would like to assimilate. As
far as Perl is concerned this is no problem, my knowledge of Perl is
good enough (actually the development of rubric started with an
assimilation of a Perl program :slight_smile:

The problem with Python is that Python’s syntax looks awful to me
and don’t like the idea of learn more Python than necessary for
assimilation. Is there an online Python tutorial that just describes
the skeleton and what which function is good for?

Josef ‘Jupp’ SCHUGT

···


http://oss.erdfunkstelle.de/ruby/ - German comp.lang.ruby-FAQ
http://rubyforge.org/users/jupp/ - Ruby projects at Rubyforge
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Germany 2004: To boldly spy where no GESTAPO / STASI has spied before

Josef ‘Jupp’ SCHUGT wrote:

Is there an online Python tutorial that just describes
the skeleton and what which function is good for?

You might start with Magnus Lie Hetland’s “Instant Python”:

http://www.hetland.org/python/instant-python.php

or the second chapter of Mark Pilgrim’s “Dive into Python”:

http://diveintopython.org/getting_to_know_python/index.html

Finally, there’s the standard Python tutorial:

http://www.python.org/doc/current/tut/tut.html

Hope this helps,

Lyle

The problem with Python is that Python’s syntax looks awful to me
and don’t like the idea of learn more Python than necessary for
assimilation. Is there an online Python tutorial that just describes
the skeleton and what which function is good for?

look at the kanguage reference:
http://python.org/doc/current/ref/ref.html
that should explain you the basic syntax.

About functions: just open python as interactive shell and use
help()like this

help(str)
Help on class str in module builtin:

class str(basestring)

str(object) → string

Return a nice string representation of the object.
If the argument is a string, the return value is the same object.

or

help(.sort)
Help on built-in function sort:

sort(…)
L.sort(cmpfunc=None) – stable sort IN PLACE; cmpfunc(x, y) →
-1, 0, 1

(btw, why the hell list.sort() in python returns ‘None’ ?)

···

il Thu, 5 Feb 2004 10:39:37 +0900, “Josef ‘Jupp’ SCHUGT” jupp@gmx.de ha scritto::

For a very straight-forward example, you might like to have
a look at the html-parser library which is a line by line
translation of the similarly-named module bundled with the
python standard library.

http://raa.ruby-lang.org/list.rhtml?name=html-parser-2

gabriele renzi wrote:

···

il Thu, 5 Feb 2004 10:39:37 +0900, “Josef ‘Jupp’ SCHUGT” jupp@gmx.de > ha scritto::

The problem with Python is that Python’s syntax looks awful to me
and don’t like the idea of learn more Python than necessary for
assimilation. Is there an online Python tutorial that just describes
the skeleton and what which function is good for?

look at the kanguage reference:
http://python.org/doc/current/ref/ref.html
that should explain you the basic syntax.

About functions: just open python as interactive shell and use
help()like this

help(str)

Help on class str in module builtin:

class str(basestring)

str(object) → string

Return a nice string representation of the object.
If the argument is a string, the return value is the same object.

or

help(.sort)

Help on built-in function sort:

sort(…)
L.sort(cmpfunc=None) – stable sort IN PLACE; cmpfunc(x, y) →
-1, 0, 1

(btw, why the hell list.sort() in python returns ‘None’ ?)

Now that we have alot of the standard docs in ri format available in
general do we have any integration between ri and irb? That would be
nice to be able to easily call them from within irb. I mean I suppose
you could just call ri Array or whatever, but nonetheless it seems
some integration is possible.

Charles Comstock

?)

Now that we have alot of the standard docs in ri format available in
general do we have any integration between ri and irb? That would be
nice to be able to easily call them from within irb. I mean I suppose
you could just call ri Array or whatever, but nonetheless it seems
some integration is possible.

go vote 'in favor of rcr 197:
http://rcrchive.net/rcr/RCR/RCR197

:wink:

···

il Thu, 05 Feb 2004 04:49:19 -0600, Charles Comstock cc1@cec.wustl.edu ha scritto::

Now that we have alot of the standard docs in ri format available in
general do we have any integration between ri and irb? That would be
nice to be able to easily call them from within irb. I mean I suppose
you could just call ri Array or whatever, but nonetheless it seems
some integration is possible.

Charles Comstock

My wish …

module RDE
#ruby development environment
rde = %w(irb gems ri rdoc )
end

class vi_rad << vi
include RDE
end

class emacs_rad << emacs
include RDE
end

Charles Comstock wrote:

Now that we have alot of the standard docs in ri format available in
general do we have any integration between ri and irb? That would be
nice to be able to easily call them from within irb. I mean I suppose
you could just call ri Array or whatever, but nonetheless it seems
some integration is possible.

Put something this in your .irbrc file:

==== .irbrc ====
def ri arg
puts ri #{arg}
end

class Module
def ri(meth=nil)
if meth
if instance_methods(false).include? meth.to_s
puts ri #{self}##{meth}
else
super
end
else
puts ri #{self}
end
end
end

···

===============

Then you can do:

String.ri
ri String # same as above
String.ri ‘reverse’
ri ‘File.new’

I tried this and it works great!

Thanks, Joel, for a most useful tip.

Mark Lindsay

···

On Fri, Feb 06, 2004 at 04:46:19AM +0900, Joel VanderWerf vjoel@PATH.Berkeley.EDU wrote:

Charles Comstock wrote:

Now that we have alot of the standard docs in ri format available in
general do we have any integration between ri and irb? That would be
nice to be able to easily call them from within irb. I mean I suppose
you could just call ri Array or whatever, but nonetheless it seems
some integration is possible.

Put something this in your .irbrc file:

==== .irbrc ====
def ri arg
puts ri #{arg}
end

class Module
def ri(meth=nil)
if meth
if instance_methods(false).include? meth.to_s
puts ri #{self}##{meth}
else
super
end
else
puts ri #{self}
end
end
end

Then you can do:

String.ri
ri String # same as above
String.ri ‘reverse’
ri ‘File.new’