Professional Web Applications Themes

An assimilators guide to Python? - Ruby

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 :-) 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 ...

  1. #1

    Default 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 :-)

    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 Guest

  2. #2

    Default Re: An assimilators guide to Python?

    Josef 'Jupp' SCHUGT wrote:
     

    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

    Lyle Guest

  3. #3

    Default Re: An assimilators guide to Python?

    il Thu, 5 Feb 2004 10:39:37 +0900, "Josef 'Jupp' SCHUGT" <de>
    ha scritto::

     

    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
     [/ref][/ref]
    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
     [/ref][/ref]
    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' ?)
    gabriele Guest

  4. #4

    Default Irb Ri integration (Was: An assimilators guide to Python?)

    gabriele renzi wrote:
     
    >
    >
    > 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
    >
    > [/ref]
    >
    > 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
    >
    > [/ref]
    >
    > 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' ?)[/ref]

    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
    Charles Guest

  5. #5

    Default Re: Irb Ri integration (Was: An assimilators guide to Python?)

    il Thu, 05 Feb 2004 04:49:19 -0600, Charles Comstock
    <wustl.edu> ha scritto::
    ?) 


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

    ;)
    gabriele Guest

  6. #6

    Default Re: Irb Ri integration (Was: An assimilators guide to Python?)




    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











    Bermejo, Guest

  7. #7

    Default Re: An assimilators guide to Python?

    For a very straight-forward example, you might like to have
    a look at the html-pr 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-pr-2>

    Bernard Guest

  8. #8

    Default Re: Irb Ri integration (Was: An assimilators guide to Python?)

    Charles Comstock wrote: 

    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:

    irb> String.ri
    irb> ri String # same as above
    irb> String.ri 'reverse'
    irb> ri 'File.new'




    Joel Guest

  9. #9

    Default Re: Irb Ri integration (Was: An assimilators guide to Python?)

    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 <Berkeley.EDU> wrote: 
    >
    > 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:
    >
    > irb> String.ri
    > irb> ri String # same as above
    > irb> String.ri 'reverse'
    > irb> ri 'File.new'[/ref]


    ppi@amug.org Guest

Similar Threads

  1. PHP vs. Python for the web
    By Unknown in forum PHP Development
    Replies: 6
    Last Post: April 16th, 11:55 AM
  2. Python for FileMaker
    By Roberto in forum FileMaker
    Replies: 2
    Last Post: February 4th, 11:57 AM
  3. Ruby vs Python?
    By Daniel Carrera in forum Ruby
    Replies: 8
    Last Post: September 17th, 04:32 PM
  4. Python and ObjC
    By Wezzy in forum Mac Programming
    Replies: 3
    Last Post: September 16th, 05:48 PM
  5. Replies: 1
    Last Post: August 23rd, 10:18 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139