is it possible to remove the ':' symbol in the end of lines starting with 'if', 'while' etc?

Discussion in 'Python' started by openopt@ukr.net, Feb 22, 2007.

  1. Guest

    I don't know to which forum should I post the message
    I hope someone related to the Python kernel development will read &
    consider the idea
    I'm (a former? meanwhile not sure) MATLAB user & it's very annoing
    typing each time for example
    while i:
    print i
    ...
    instead of
    while i
    print i
    ...
    of course if all is written in a single line ':' I guess should not be
    omited

    Thank you for you suggestions.
    Sorry my bad English.

    WBR, Dmitrey
    , Feb 22, 2007
    #1
    1. Advertising

  2. wrote:

    > I don't know to which forum should I post the message
    > I hope someone related to the Python kernel development will read &
    > consider the idea
    > I'm (a former? meanwhile not sure) MATLAB user & it's very annoing
    > typing each time for example
    > while i:
    > print i
    > ...
    > instead of
    > while i
    > print i
    > ...
    > of course if all is written in a single line ':' I guess should not be
    > omited


    Won't happen. There have been plenty of discussions about this, and while
    technically not necessary, the colon is usually considered "optically
    pleasing". So - it will stay.

    See - one of a bazillion - discussions here:

    http://groups.google.com/group/comp...q=python colon remove&rnum=1#35581ad9698e28f5


    Diez
    Diez B. Roggisch, Feb 22, 2007
    #2
    1. Advertising

  3. Flavio Guest

    On Feb 22, 9:49 am, wrote:
    > I don't know to which forum should I post the message
    > I hope someone related to the Python kernel development will read &
    > consider the idea
    > I'm (a former? meanwhile not sure) MATLAB user & it's very annoing
    > typing each time for example
    > while i:
    > print i
    > ...
    > instead of
    > while i
    > print i
    > ...
    > of course if all is written in a single line ':' I guess should not be
    > omited
    >
    > Thank you for you suggestions.
    > Sorry my bad English.
    >
    > WBR, Dmitrey


    Think on the bright side:

    you have to type ":" at the beginning of loop and conditional blocks,
    but you don't have to type "end" at the end... you are still saving
    two strokes...
    ;-))
    Flavio, Feb 22, 2007
    #3
  4. justme Guest

    On 22 Feb, 11:49, wrote:
    > I don't know to which forum should I post the message
    > I hope someone related to the Python kernel development will read &
    > consider the idea
    > I'm (a former? meanwhile not sure) MATLAB user & it's very annoing
    > typing each time for example
    > while i:
    > print i
    > ...
    > instead of
    > while i
    > print i
    > ...
    > of course if all is written in a single line ':' I guess should not be
    > omited
    >
    > Thank you for you suggestions.
    > Sorry my bad English.
    >
    > WBR, Dmitrey


    Hi

    Just a thought...
    I've also just made the jump from Matlab to Python (or am straddling
    the two at the moment!) and I find the ':' really useful for
    delimiting blocks of code. Took a while to get used to it but I reckon
    it helps me explain my code to non-programmers as they can see the
    blocks I use.

    Al
    justme, Feb 22, 2007
    #4
  5. Guest

    > Think on the bright side:
    >
    > you have to type ":" at the beginning of loop and conditional blocks,
    > but you don't have to type "end" at the end... you are still saving
    > two strokes...
    > ;-))


    No, there no profits:
    instead of 'end' I must type <shift>, ':' and backspace in the end of
    block - so 3 keypress are used, same as 'end'
    Of course Python is much more better in syntax vs C/C++ but I would
    prefere tcl-style or caml-style
    x = fun arg1 arg2 ... argn
    however, in tcl annoing things are 'set' and 'expr'
    and in ocaml '<-' and 'let x = ... in' - too many keypress instead of
    '='
    but their func calls still is better then fun(arg1, arg2, ..., argn)
    and help _something_ or which _something_ in MATLAB is much more
    better then help(_something_) in Python
    the only bad thing in MATLAB (+absence of x = fun arg1 arg2 ... argn
    call) is indexing arrays by () instead of [] - holding shift key
    dozens times per day is very unconvinient.
    And in Python vs MATLAB is very unconvinient arrays creation.

    I'm very afraid of proposition that I noticed at
    http://wiki.python.org/moin/SummerOfCode
    Base multidimensional array type for Python core
    Student: KarolLangner
    Mentor: Travis E. Oliphant
    I don't know about anyone mentioned but I'm not sure this is a good
    idea to hire ordinary student for such important thing.
    And writing 'dimarray(...)' dozens times per day is much more bad than
    x = matrix('...'), x = array([...]) or, of course, MATLAB-style x = [1
    2 3]
    I guess it should 10 times more think about the array and make it once
    and forever - Python already has some array-related classes and all
    with syntax much more bad than MATLAB. I guess there should be only 2
    types: one for storing data in convinient way without reallocating
    (something like C++ STL vector<>) and one for quick calculations
    (something like C++ valarray).
    WBR, Dmitrey.
    , Feb 22, 2007
    #5
  6. James Stroud Guest

    Re: is it possible to remove the ':' symbol in the end of lines startingwith 'if', 'while' etc?

    wrote:
    > I don't know to which forum should I post the message
    > I hope someone related to the Python kernel development will read &
    > consider the idea
    > I'm (a former? meanwhile not sure) MATLAB user & it's very annoing
    > typing each time for example
    > while i:
    > print i
    > ...
    > instead of
    > while i
    > print i
    > ...
    > of course if all is written in a single line ':' I guess should not be
    > omited
    >
    > Thank you for you suggestions.
    > Sorry my bad English.
    >
    > WBR, Dmitrey
    >


    Its a compromise in that python has way-less of this kind of cruft than
    a lot of other languages.

    James
    James Stroud, Feb 22, 2007
    #6
  7. tac-tics Guest

    Tip: don't try learning perl.

    I agree the colon is largely redundant, but it's not unreasonable.
    tac-tics, Feb 22, 2007
    #7
  8. On 2007-02-22, tac-tics <> wrote:

    > Tip: don't try learning perl.
    >
    > I agree the colon is largely redundant, but it's not
    > unreasonable.


    A certain amount of redundancy in languages (artificial or
    natrual) is a good thing. It makes error detection and
    correction far easier.

    --
    Grant Edwards grante Yow! ... I think I'm
    at having an overnight
    visi.com sensation right now!!
    Grant Edwards, Feb 23, 2007
    #8
  9. Re: is it possible to remove the ':' symbol in the end oflinesstarting with 'if', 'while' etc?

    "Diez B. Roggisch" <> wrote:

    > wrote:


    8< ---------------- request to remove colon ----------------------

    > Won't happen. There have been plenty of discussions about this, and while
    > technically not necessary, the colon is usually considered "optically
    > pleasing". So - it will stay.


    It is also used by text editors to make indentation of the next line happen...

    - Hendrik
    Hendrik van Rooyen, Feb 23, 2007
    #9
    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. baumann@pan
    Replies:
    1
    Views:
    742
    Richard Bos
    Apr 15, 2005
  2. Murali
    Replies:
    2
    Views:
    560
    Jerry Coffin
    Mar 9, 2006
  3. Kevin Walzer

    Re: PIL (etc etc etc) on OS X

    Kevin Walzer, Aug 1, 2008, in forum: Python
    Replies:
    4
    Views:
    390
    Fredrik Lundh
    Aug 13, 2008
  4. Nikolai Weibull
    Replies:
    7
    Views:
    124
    Daniel Brockman
    Aug 31, 2005
  5. Song Ma
    Replies:
    2
    Views:
    229
    Charles Oliver Nutter
    Jul 20, 2008
Loading...

Share This Page