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. Advertising

  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. Advertising

  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. Advertising

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. QuadriKev
    Replies:
    3
    Views:
    374
    cosmo
    Nov 15, 2005
  2. Metaosp
    Replies:
    8
    Views:
    365
    Marcin Kalicinski
    Feb 7, 2006
  3. defn noob
    Replies:
    1
    Views:
    398
    Mark Space
    Jun 28, 2008
  4. Richard
    Replies:
    1
    Views:
    334
    Luc Hermitte
    Sep 24, 2009
  5. Replies:
    9
    Views:
    174
Loading...

Share This Page