Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #39463 > unrolled thread

Python Newbie

Started byPiterrr <piterrr.dolinski@gmail.com>
First post2013-02-21 13:26 -0800
Last post2013-02-25 19:37 -0800
Articles 1 on this page of 161 — 34 participants

Back to article view | Back to comp.lang.python


Contents

  Python Newbie Piterrr <piterrr.dolinski@gmail.com> - 2013-02-21 13:26 -0800
    Re: Python Newbie Ian Kelly <ian.g.kelly@gmail.com> - 2013-02-21 14:54 -0700
    Re: Python Newbie MRAB <python@mrabarnett.plus.com> - 2013-02-21 21:58 +0000
    Re: Python Newbie Chris Angelico <rosuav@gmail.com> - 2013-02-22 08:59 +1100
    Re: Python Newbie Peter Pearson <ppearson@nowhere.invalid> - 2013-02-21 22:03 +0000
    Re: Python Newbie Dave Angel <davea@davea.name> - 2013-02-21 17:22 -0500
    Re: Python Newbie piterrr.dolinski@gmail.com - 2013-02-21 14:40 -0800
      Re: Python Newbie Chris Angelico <rosuav@gmail.com> - 2013-02-22 10:21 +1100
        Re: Python Newbie piterrr.dolinski@gmail.com - 2013-02-21 15:34 -0800
          Re: Python Newbie Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-02-21 23:48 +0000
          Re: Python Newbie Chris Angelico <rosuav@gmail.com> - 2013-02-22 11:32 +1100
          Re: Python Newbie Michael Torrie <torriem@gmail.com> - 2013-02-23 11:58 -0700
        Re: Python Newbie piterrr.dolinski@gmail.com - 2013-02-21 15:34 -0800
      Re: Python Newbie Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2013-02-21 23:27 +0000
      Re: Python Newbie Ian Kelly <ian.g.kelly@gmail.com> - 2013-02-21 16:55 -0700
      Re: Python Newbie rusi <rustompmody@gmail.com> - 2013-02-21 22:57 -0800
      Re: Python Newbie Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-02-22 10:26 +0000
        Re: Python Newbie Steve Simmons <square.steve@gmail.com> - 2013-02-22 12:05 +0100
        Re: Python Newbie Chris Angelico <rosuav@gmail.com> - 2013-02-22 22:23 +1100
      Re: Python Newbie Michael Torrie <torriem@gmail.com> - 2013-02-23 16:04 -0700
      Re: Python Newbie Vito De Tullio <vito.detullio@gmail.com> - 2013-02-24 09:23 +0100
      Re: Python Newbie "J.R." <groups_jr-1@yahoo.com.br> - 2013-02-24 23:02 -0300
        Re: Python Newbie Roy Smith <roy@panix.com> - 2013-02-24 21:03 -0500
          Re: Python Newbie "J.R." <groups_jr-1@yahoo.com.br> - 2013-02-24 23:35 -0300
          Re: Python Newbie Chris Angelico <rosuav@gmail.com> - 2013-02-25 13:31 +1100
    Re: Python Newbie Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-02-21 19:35 -0500
    Re: Python Newbie Mitya Sirenef <msirenef@lightbird.net> - 2013-02-21 23:50 -0500
      Re: Python Newbie Rui Maciel <rui.maciel@gmail.com> - 2013-02-22 11:58 +0000
        Re: Python Newbie Chris Angelico <rosuav@gmail.com> - 2013-02-22 23:12 +1100
          Re: Python Newbie Rui Maciel <rui.maciel@gmail.com> - 2013-02-22 13:50 +0000
            Re: Python Newbie Chris Angelico <rosuav@gmail.com> - 2013-02-23 01:05 +1100
              Re: Python Newbie Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-02-23 00:03 +0000
                Re: Python Newbie Chris Angelico <rosuav@gmail.com> - 2013-02-23 11:21 +1100
            Re: Python Newbie Duncan Booth <duncan.booth@invalid.invalid> - 2013-02-22 14:26 +0000
              Re: Python Newbie Steve Simmons <square.steve@gmail.com> - 2013-02-22 15:45 +0100
                Re: Python Newbie Duncan Booth <duncan.booth@invalid.invalid> - 2013-02-22 15:02 +0000
              Re: Python Newbie Chris Angelico <rosuav@gmail.com> - 2013-02-23 02:06 +1100
                Re: Python Newbie piterrr.dolinski@gmail.com - 2013-02-22 13:37 -0800
                  Re: Python Newbie Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2013-02-22 22:08 +0000
                  Re: Python Newbie Ian Kelly <ian.g.kelly@gmail.com> - 2013-02-22 15:45 -0700
                    Re: Python Newbie piterrr.dolinski@gmail.com - 2013-02-22 15:38 -0800
                      Re: Python Newbie Chris Angelico <rosuav@gmail.com> - 2013-02-23 11:17 +1100
                      Re: Python Newbie Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-02-23 13:29 -0500
                      Re: Python Newbie Chris Angelico <rosuav@gmail.com> - 2013-02-24 08:38 +1100
                      Re: Python Newbie Michael Torrie <torriem@gmail.com> - 2013-02-23 15:52 -0700
                      Re: Python Newbie Chris Angelico <rosuav@gmail.com> - 2013-02-24 10:18 +1100
                        Re: Python Newbie piterrr.dolinski@gmail.com - 2013-02-23 15:46 -0800
                          Re: Python Newbie Larry Hudson <orgnut@yahoo.com> - 2013-02-23 20:20 -0800
                            Re: Python Newbie Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-02-24 14:34 +0000
                              Re: Python Newbie piterrr.dolinski@gmail.com - 2013-02-24 07:46 -0800
                                Re: Python Newbie Chris Angelico <rosuav@gmail.com> - 2013-02-25 02:52 +1100
                                  Re: Python Newbie Roy Smith <roy@panix.com> - 2013-02-24 11:22 -0500
                                Re: Python Newbie Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-02-24 17:44 +0000
                                  Re: Python Newbie piterrr.dolinski@gmail.com - 2013-02-24 11:29 -0800
                                    Re: Python Newbie Joshua Landau <joshua.landau.ws@gmail.com> - 2013-02-24 21:35 +0000
                                      Re: Python Newbie piterrr.dolinski@gmail.com - 2013-02-24 14:43 -0800
                                        Re: Python Newbie Joel Goldstick <joel.goldstick@gmail.com> - 2013-02-24 18:05 -0500
                                        Re: Python Newbie Joshua Landau <joshua.landau.ws@gmail.com> - 2013-02-24 23:13 +0000
                                      Re: Python Newbie piterrr.dolinski@gmail.com - 2013-02-24 14:43 -0800
                                        Re: Python Newbie Larry Hudson <orgnut@yahoo.com> - 2013-02-26 00:32 -0800
                                          Re: Python Newbie rurpy@yahoo.com - 2013-02-26 10:23 -0800
                                            Re: Python Newbie Ethan Furman <ethan@stoneleaf.us> - 2013-02-26 10:59 -0800
                                              Re: Python Newbie rurpy@yahoo.com - 2013-02-26 13:30 -0800
                                      Re: Python Newbie Michael Torrie <torriem@gmail.com> - 2013-02-24 18:31 -0700
                                    Re: Python Newbie Chris Angelico <rosuav@gmail.com> - 2013-02-25 09:08 +1100
                                    Re: Python Newbie Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2013-02-24 23:18 +0000
                                    Re: Python Newbie Joshua Landau <joshua.landau.ws@gmail.com> - 2013-02-24 22:51 +0000
                                      Re: Python Newbie piterrr.dolinski@gmail.com - 2013-02-24 15:38 -0800
                                        Re: Python Newbie Chris Angelico <rosuav@gmail.com> - 2013-02-25 10:45 +1100
                                        Re: Python Newbie Ethan Furman <ethan@stoneleaf.us> - 2013-02-24 15:53 -0800
                                          Re: Python Newbie piterrr.dolinski@gmail.com - 2013-02-24 16:08 -0800
                                            Re: Python Newbie Joshua Landau <joshua.landau.ws@gmail.com> - 2013-02-25 00:28 +0000
                                            Re: Python Newbie Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-02-25 00:38 +0000
                                            Re: Python Newbie Ethan Furman <ethan@stoneleaf.us> - 2013-02-24 16:33 -0800
                                            Re: Python Newbie Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2013-02-25 00:45 +0000
                                            Re: Python Newbie Roy Smith <roy@panix.com> - 2013-02-24 19:50 -0500
                                            Re: Python Newbie Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-02-25 01:04 +0000
                                              Re: Python Newbie Chris Angelico <rosuav@gmail.com> - 2013-02-25 12:27 +1100
                                              Re: Python Newbie Michael Torrie <torriem@gmail.com> - 2013-02-24 18:42 -0700
                                            Re: Python Newbie Chris Angelico <rosuav@gmail.com> - 2013-02-25 12:24 +1100
                                            Re: Python Newbie Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2013-02-25 01:44 +0000
                                            Re: Python Newbie Chris Angelico <rosuav@gmail.com> - 2013-02-25 12:53 +1100
                                            Re: Python Newbie MRAB <python@mrabarnett.plus.com> - 2013-02-25 02:23 +0000
                                            Re: Python Newbie Ethan Furman <ethan@stoneleaf.us> - 2013-02-24 18:59 -0800
                                          Re: Python Newbie piterrr.dolinski@gmail.com - 2013-02-24 16:08 -0800
                                          Re: Python Newbie Roy Smith <roy@panix.com> - 2013-02-24 19:42 -0500
                                      Re: Python Newbie piterrr.dolinski@gmail.com - 2013-02-24 15:38 -0800
                                    Re: Python Newbie Joshua Landau <joshua.landau.ws@gmail.com> - 2013-02-24 23:21 +0000
                                Re: Python Newbie Dave Angel <davea@davea.name> - 2013-02-24 17:47 -0500
                                Re: Python Newbie Serhiy Storchaka <storchaka@gmail.com> - 2013-02-25 14:40 +0200
                              Re: Python Newbie piterrr.dolinski@gmail.com - 2013-02-24 07:46 -0800
                          Re: Python Newbie Michael Torrie <torriem@gmail.com> - 2013-02-23 22:23 -0700
                      Re: Python Newbie MRAB <python@mrabarnett.plus.com> - 2013-02-24 00:11 +0000
                      Re: Python Newbie Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-02-24 12:37 -0500
                      Re: Python Newbie Michael Torrie <torriem@gmail.com> - 2013-02-24 10:56 -0700
                        Re: Python Newbie Roy Smith <roy@panix.com> - 2013-02-24 13:07 -0500
                      Re: Python Newbie Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-02-24 21:01 -0500
                    Re: Python Newbie piterrr.dolinski@gmail.com - 2013-02-22 15:38 -0800
                  Re: Python Newbie Terry Reedy <tjreedy@udel.edu> - 2013-02-22 20:04 -0500
                    Re: Python Newbie rurpy@yahoo.com - 2013-02-22 18:48 -0800
                  Re: Python Newbie Mitya Sirenef <msirenef@lightbird.net> - 2013-02-22 20:47 -0500
                    Re: Python Newbie Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-02-23 02:02 +0000
                      Re: Python Newbie Chris Angelico <rosuav@gmail.com> - 2013-02-23 13:18 +1100
                        Re: Python Newbie Grant Edwards <invalid@invalid.invalid> - 2013-02-24 18:19 +0000
                          Re: Python Newbie Chris Angelico <rosuav@gmail.com> - 2013-02-25 07:25 +1100
                      Re: Python Newbie Mitya Sirenef <msirenef@lightbird.net> - 2013-02-22 21:40 -0500
                      Re: Python Newbie Chris Angelico <rosuav@gmail.com> - 2013-02-23 13:48 +1100
                      Re: Python Newbie Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-02-23 02:59 +0000
                      Re: Python Newbie Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-02-23 13:34 -0500
                      Re: Python Newbie Chris Angelico <rosuav@gmail.com> - 2013-02-24 08:40 +1100
                      Re: Python Newbie Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-02-24 12:41 -0500
                  Re: Python Newbie Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-02-23 04:13 +0000
                    Re: Python Newbie Serhiy Storchaka <storchaka@gmail.com> - 2013-02-23 11:48 +0200
                  Re: Python Newbie Rui Maciel <rui.maciel@gmail.com> - 2013-02-23 12:30 +0000
                  Re: Python Newbie Steve Simmons <square.steve@gmail.com> - 2013-02-23 16:43 +0100
                    Re: Python Newbie jmfauth <wxjmfauth@gmail.com> - 2013-02-23 10:44 -0800
                      Re: Python Newbie Ian Kelly <ian.g.kelly@gmail.com> - 2013-02-23 12:13 -0700
                      Re: Python Newbie Ethan Furman <ethan@stoneleaf.us> - 2013-02-23 11:08 -0800
                        Re: Python Newbie jmfauth <wxjmfauth@gmail.com> - 2013-02-23 12:53 -0800
                          Re: Python Newbie Chris Angelico <rosuav@gmail.com> - 2013-02-24 08:48 +1100
                          Re: Python Newbie Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-02-24 00:02 +0000
                      Re: Python Newbie Michael Torrie <torriem@gmail.com> - 2013-02-23 12:16 -0700
                      Re: Python Newbie Matej Cepl <mcepl@redhat.com> - 2013-02-24 00:06 +0100
                  Re: Python Newbie Chris Angelico <rosuav@gmail.com> - 2013-02-24 02:51 +1100
                    Re: Python Newbie Matej Cepl <mcepl@redhat.com> - 2013-02-24 00:04 +0100
                  Re: Python Newbie Ethan Furman <ethan@stoneleaf.us> - 2013-02-23 08:32 -0800
                  Re: Python Newbie Steve Simmons <square.steve@gmail.com> - 2013-02-23 18:39 +0100
                  Re: Python Newbie Michael Torrie <torriem@gmail.com> - 2013-02-23 12:19 -0700
                  Re: Python Newbie Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-02-24 17:11 +0000
                    Re: Python Newbie piterrr.dolinski@gmail.com - 2013-02-24 11:40 -0800
                      Re: Python Newbie Mitya Sirenef <msirenef@lightbird.net> - 2013-02-24 15:06 -0500
                      Re: Python Newbie "Michael Ross" <gmx@ross.cx> - 2013-02-24 21:33 +0100
                      Re: Python Newbie MRAB <python@mrabarnett.plus.com> - 2013-02-24 20:34 +0000
                      Re: Python Newbie Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-02-24 20:41 +0000
                      Re: Python Newbie Ethan Furman <ethan@stoneleaf.us> - 2013-02-24 12:34 -0800
                      Re: Python Newbie Chris Angelico <rosuav@gmail.com> - 2013-02-25 07:42 +1100
                        Re: Python Newbie Roy Smith <roy@panix.com> - 2013-02-24 15:48 -0500
                          Re: Python Newbie Joshua Landau <joshua.landau.ws@gmail.com> - 2013-02-24 21:58 +0000
                          Re: Python Newbie Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-02-24 21:08 -0500
                          Re: Python Newbie Joshua Landau <joshua.landau.ws@gmail.com> - 2013-02-25 02:59 +0000
                      Re: Python Newbie Chris Angelico <rosuav@gmail.com> - 2013-02-25 07:47 +1100
                      Re: Python Newbie Chris Angelico <rosuav@gmail.com> - 2013-02-25 07:58 +1100
                        Re: Python Newbie Roy Smith <roy@panix.com> - 2013-02-24 16:08 -0500
                          Re: Python Newbie Chris Angelico <rosuav@gmail.com> - 2013-02-25 08:44 +1100
                          Re: Python Newbie Mitya Sirenef <msirenef@lightbird.net> - 2013-02-24 17:40 -0500
                            Re: Python Newbie Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-02-25 01:11 +0000
                          Re: Python Newbie Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-02-25 00:42 +0000
                          Re: Python Newbie Michael Torrie <torriem@gmail.com> - 2013-02-24 18:34 -0700
                      Re: Python Newbie Ethan Furman <ethan@stoneleaf.us> - 2013-02-24 14:33 -0800
                      Re: Python Newbie Albert Hopkins <marduk@letterboxes.org> - 2013-02-24 18:32 -0500
                      Re: Python Newbie Chris Angelico <rosuav@gmail.com> - 2013-02-25 10:44 +1100
                      Re: Python Newbie Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-02-25 01:06 +0000
                    Re: Python Newbie piterrr.dolinski@gmail.com - 2013-02-24 11:40 -0800
                Re: Python Newbie piterrr.dolinski@gmail.com - 2013-02-22 13:37 -0800
        Re: Python Newbie Mitya Sirenef <msirenef@lightbird.net> - 2013-02-22 20:05 -0500
    Re: Python Newbie Gene Heskett <gheskett@wdtv.com> - 2013-02-23 12:32 -0500
    Re: Python Newbie Steve Simmons <square.steve@gmail.com> - 2013-02-23 19:10 +0100
    Re: Python Newbie Michael Torrie <torriem@gmail.com> - 2013-02-23 11:40 -0700
    Re: Python Newbie Michael Torrie <torriem@gmail.com> - 2013-02-23 12:15 -0700
    Re: Python Newbie Gene Heskett <gheskett@wdtv.com> - 2013-02-23 17:49 -0500
    Re: Python Newbie Nick Mellor <thebalancepro@gmail.com> - 2013-02-25 19:37 -0800

Page 9 of 9 — ← Prev page 1 2 3 4 5 6 7 8 [9]


#39925

FromNick Mellor <thebalancepro@gmail.com>
Date2013-02-25 19:37 -0800
Message-ID<b9fa04ee-d14e-46c2-bef4-b327aff6668a@googlegroups.com>
In reply to#39463
Hi Piterr,

It's interesting how strong our habits are, isn't it? It's most likely you've just got a bit of culture shock.

I've used C# quite a bit as well as Python. I like them both.

What I like about Python is how it manages to be clear and terse at the same time.

if (flag==1) {
    code
}

has quite a bit of redundancy in it (C or C#.) In Python:

if flag:
    code

is a good shorthand that matches any non-zero value. Gone are the brackets and the braces and the meaning is crystal clear.

In the middle of a complex piece of code this clarity of syntax is fantastic for anyone reading the code-- so long as they know how Python works.

You may discover as you continue with Python that there is actually quite a lot of freedom about how you use white space. Python doesn't much care *how* much you indent, just that you're consistent within the block:

if flag:
            # do something
            # do something else
# continue coding after the if stmt

is equivalent to

if flag:
  # do something
  # do something else
# continue coding after the if stmt

You're also allowed to break a line inside brackets, braces etc and use any indenting you like:

if flag:
    [o.process(i % 3 + w)
         for i, o, w
             in enumerate(zip(objects, words))
    ]
    # do something else
# this is after the if block

The following is a good thread about "implied line continuation" (i.e. where line breaks and free indentation are allowed inside braces, square brackets or round brackets.)

http://stackoverflow.com/questions/53162/how-can-i-do-a-line-break-line-continuation-in-python

See also the Python style guide:

http://www.python.org/dev/peps/pep-0008/

There's also explicit line continuation, rather like Visual Basic:

if c + \
    256 * \
    (d + 256 * e) > 69427:
       # do something
       # do something else
# then leave the if block

Again, the line continuation doesn't mind what indent you use after it.

In this case you could put brackets around the expression and use implied line continuation:

if (c +
    256 *
    (d + 256 * e)) > 69427:
       # do something
       # do something else
# then leave the if block

This is the preferred method according to the Python style guide.

I hope you manage to give Python (and your job) a little longer to charm you
:-)

Cheers,

Nick

On Friday, 22 February 2013 08:26:41 UTC+11, Piterrr  wrote:
> Hi folks.
> 
> I am a long time C sharp dev, just learning Python now due to job requirements. My initial impression is that Python has got to be the most ambiguous and vague language I have seen to date. I have major issues with the fact that white space matters. How do you deal with this? For example, you open a source file in different editors and the indentation levels change even though i only have spaces, no tabs (compare Windows Notepad and Notepad++). Which editor do you trust? In addition, code is difficult to read because you cannot lay it out in easily discernable blocks. For example, I always tend to indent a full 'if' statement block so that it is easier to see where the if block starts and ends. Can't do that in Python. What is even more frustrating is that Python is inconsistent with its syntax. For example, when I write "if (myVariable != 0):" then this is OK but "for (i in intAry):" results in syntax error. Apparently Python has problems with my use of parentheses. How retarded. I think I will rather find another job than eat my nerves with Python.
> 
> Any comments on this before I quit my job?

[toc] | [prev] | [standalone]


Page 9 of 9 — ← Prev page 1 2 3 4 5 6 7 8 [9]

Back to top | Article view | comp.lang.python


csiph-web