Re: Python-by-example - new online guide to Python Standard Library

Discussion in 'Python' started by GHUM, Apr 2, 2008.

  1. GHUM

    GHUM Guest

    Tobu,

    I like this idea. Deducting from an example is really another way to
    wisdom.

    What struck me as most diffuclt to understand:

    abs(-5.5) - 5.5

    -> you are using "-" as symbol for "will give the result", which is
    really, really hard to parse. Take something else, please. Unicode has
    THAT many cool symbols. Or just -> or -=> or whatever.

    Thanks for sharing that work!

    Harald
     
    GHUM, Apr 2, 2008
    #1
    1. Advertisements

  2. GHUM

    Guest

    On Apr 2, 2:43 pm, GHUM <> wrote:
    > Tobu,
    >
    > I like this idea. Deducting from an example is really another way to
    > wisdom.
    >
    > What struck me as most diffuclt to understand:
    >
    > abs(-5.5) - 5.5
    >
    > -> you are using "-" as symbol for "will give the result", which is
    > really, really hard to parse. Take something else, please. Unicode has
    > THAT many cool symbols. Or just -> or -=> or whatever.
    >
    > Thanks for sharing that work!
    >
    > Harald



    Or just use comments to indicate text that tells what the code does.

    I too agree you need to change the '-'.
     
    , Apr 2, 2008
    #2
    1. Advertisements

  3. GHUM

    sjf Guest

    Indeed, the first thing I saw on the front page was "math.sqrt(9) -
    3.0". Ok, I thought, random arithmetic expression, so what?
    There is already a standard way of showing a piece of code and its
    results. It's the interactive prompt:

    >>> import math
    >>> math.sqrt(9)

    3.0
    >>>


    Tada!


    On Apr 2, 12:43 pm, GHUM <> wrote:
    > Tobu,
    >
    > I like this idea. Deducting from an example is really another way to
    > wisdom.
    >
    > What struck me as most diffuclt to understand:
    >
    > abs(-5.5) - 5.5
    >
    > -> you are using "-" as symbol for "will give the result", which is
    > really, really hard to parse. Take something else, please. Unicode has
    > THAT many cool symbols. Or just -> or -=> or whatever.
    >
    > Thanks for sharing that work!
    >
    > Harald
     
    sjf, Apr 2, 2008
    #3
  4. GHUM

    Panzerlurch Guest

    Why don't use the normal Python shell syntax as used by doctest?

    >>> abs(-5.5)

    5.5

    That would be much more readable.
     
    Panzerlurch, Apr 2, 2008
    #4
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. steve.leach

    How standard is the standard library?

    steve.leach, Apr 18, 2005, in forum: Python
    Replies:
    1
    Views:
    550
    Christos TZOTZIOY Georgiou
    Apr 18, 2005
  2. QuadriKev
    Replies:
    3
    Views:
    448
    cosmo
    Nov 15, 2005
  3. funkyj
    Replies:
    5
    Views:
    1,449
    funkyj
    Jan 20, 2006
  4. Metaosp
    Replies:
    8
    Views:
    491
    Marcin Kalicinski
    Feb 7, 2006
  5. defn noob
    Replies:
    1
    Views:
    604
    Mark Space
    Jun 28, 2008
  6. Richard
    Replies:
    1
    Views:
    453
    Luc Hermitte
    Sep 24, 2009
  7. Michael Crute
    Replies:
    0
    Views:
    625
    Michael Crute
    Jun 14, 2010
  8. Replies:
    9
    Views:
    311
Loading...