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 20 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 8 of 9 — ← Prev page 1 2 3 4 5 6 7 [8] 9  Next page →


#39790

FromChris Angelico <rosuav@gmail.com>
Date2013-02-25 07:47 +1100
Message-ID<mailman.2436.1361738870.2939.python-list@python.org>
In reply to#39778
On Mon, Feb 25, 2013 at 7:41 AM, Mark Lawrence <breamoreboy@yahoo.co.uk> wrote:
> Your words "the use of () has been widespread and mandated by the compilers"
> and "have long used () where they are required".  As they are neither
> mandated nor required in Python it just wastes the time of anybody reading
> code as they have to parse something that offers nothing except visual
> noise.  As for being "visually pleasing" that's simply laughable.  I want to
> be able to read code, not hang it in an art gallery.

Most of what gets hung in art galleries these days is far less
visually pleasing than well-written code.

ChrisA

[toc] | [prev] | [next] | [standalone]


#39793

FromChris Angelico <rosuav@gmail.com>
Date2013-02-25 07:58 +1100
Message-ID<mailman.2438.1361739512.2939.python-list@python.org>
In reply to#39778
On Mon, Feb 25, 2013 at 7:34 AM, Ethan Furman <ethan@stoneleaf.us> wrote:
> One of the things I love about Python is its ability to get out of the way
> and let me work:
>
>   - no variable declarations, just use 'em
>   - no type declarations, just use 'em
>   - no need to remember what's an object and what's not -- everything is an
> object
>   - no need to cast to bool as everything has a truthy/falsey (something vs
> nothing) value

Variable declarations can go either way; Python requires you to name
all globals that you mutate, and to be careful when working with
nested functions. With declared variables, you name all locals, and
can enforce scoping and destructors without language features like
'with'. Both options are viable.

I absolutely agree with your third point. Treat 'em all as objects!
But of *course*, Java is "more object oriented" than Python. Everyone
knows that.

ChrisA

[toc] | [prev] | [next] | [standalone]


#39798

FromRoy Smith <roy@panix.com>
Date2013-02-24 16:08 -0500
Message-ID<roy-193546.16080124022013@news.panix.com>
In reply to#39793
In article <mailman.2438.1361739512.2939.python-list@python.org>,
 Chris Angelico <rosuav@gmail.com> wrote:

> > no need to remember what's an object and what's not -- everything is an
> > object

Well, not quite everything.  If I write:

if foo:
   do_this()
   and_this()

the code block making up the body of the "if" statement is not an 
object.  In some languages, it is.

[toc] | [prev] | [next] | [standalone]


#39801

FromChris Angelico <rosuav@gmail.com>
Date2013-02-25 08:44 +1100
Message-ID<mailman.2442.1361742263.2939.python-list@python.org>
In reply to#39798
On Mon, Feb 25, 2013 at 8:08 AM, Roy Smith <roy@panix.com> wrote:
> In article <mailman.2438.1361739512.2939.python-list@python.org>,
>  Chris Angelico <rosuav@gmail.com> wrote:
>
>> > no need to remember what's an object and what's not -- everything is an
>> > object

Careful on the citations - Ethan Furman said that, I just quoted him.

> Well, not quite everything.  If I write:
>
> if foo:
>    do_this()
>    and_this()
>
> the code block making up the body of the "if" statement is not an
> object.  In some languages, it is.

Maybe, but the code of an entire function *is*. Granted, it's not an
object that can be built up manually (at least, not that I know of),
and it offers only limited functionality (dis.dis, but not a lot
else), so really it could be seen as just an implementation detail of
the function object itself. But it's still an object.

ChrisA

[toc] | [prev] | [next] | [standalone]


#39806

FromMitya Sirenef <msirenef@lightbird.net>
Date2013-02-24 17:40 -0500
Message-ID<mailman.2446.1361745672.2939.python-list@python.org>
In reply to#39798
On 02/24/2013 04:44 PM, Chris Angelico wrote:
> On Mon, Feb 25, 2013 at 8:08  AM, Roy Smith <roy@panix.com> wrote:
 >> In article <mailman.2438.1361739512.2939.python-list@python.org>,
 >> Chris Angelico <rosuav@gmail.com> wrote:
 >>
 >>>> no need to remember what's an object and what's not -- everything 
is an
 >>>> object
 >
 > Careful on the citations - Ethan Furman said that, I just quoted him.
 >
 >> Well, not quite everything. If I write:
 >>
 >> if foo:
 >> do_this()
 >> and_this()
 >>
 >> the code block making up the body of the "if" statement is not an
 >> object. In some languages, it is.
 >
 > Maybe, but the code of an entire function *is*. Granted, it's not an
 > object that can be built up manually (at least, not that I know of),
 > and it offers only limited functionality (dis.dis, but not a lot
 > else), so really it could be seen as just an implementation detail of
 > the function object itself. But it's still an object.
 >
 > ChrisA


But if block doesn't have to be inside a function, right? It needs
to be inside a module, but then again everything is inside a module, but
it wouldn't be very object-oriented if the module was the only object in
Python :-).

  -m


-- 
Lark's Tongue Guide to Python: http://lightbird.net/larks/

The press, the machine, the railway, the telegraph are premises whose
thousand-year conclusion no one has yet dared to draw.  Friedrich Nietzsche

[toc] | [prev] | [next] | [standalone]


#39846

FromSteven D'Aprano <steve+comp.lang.python@pearwood.info>
Date2013-02-25 01:11 +0000
Message-ID<512aba50$0$29998$c3e8da3$5496439d@news.astraweb.com>
In reply to#39806
On Sun, 24 Feb 2013 17:40:54 -0500, Mitya Sirenef wrote:

> But if block doesn't have to be inside a function, right? It needs to be
> inside a module, but then again everything is inside a module, but it
> wouldn't be very object-oriented if the module was the only object in
> Python :-).

Python doesn't have code blocks as distinct values. I suppose you could 
fake it using compile() and eval() by hand, but it wouldn't work very 
well.

Ruby-style code blocks have been requested for many years. GvR has given 
his support to this *in principle*, but it depends on somebody thinking 
up decent, unambiguous syntax that works with the rest of Python.


-- 
Steven

[toc] | [prev] | [next] | [standalone]


#39837

FromSteven D'Aprano <steve+comp.lang.python@pearwood.info>
Date2013-02-25 00:42 +0000
Message-ID<512ab390$0$29998$c3e8da3$5496439d@news.astraweb.com>
In reply to#39798
On Sun, 24 Feb 2013 16:08:01 -0500, Roy Smith wrote:

> In article <mailman.2438.1361739512.2939.python-list@python.org>,
>  Chris Angelico <rosuav@gmail.com> wrote:
> 
>> > no need to remember what's an object and what's not -- everything is
>> > an object
> 
> Well, not quite everything.  If I write:
> 
> if foo:
>    do_this()
>    and_this()
> 
> the code block making up the body of the "if" statement is not an
> object.  In some languages, it is.


In Python, that code block isn't any *thing*. It's merely a small part of 
the enclosing code block, which *is* an object.

When we say "everything is an object" in Python, we're talking about 
values, not arbitrary language constructs. The "*3" bit of "y = x*3" is 
not a value, a for-loop is not a value, and the delay you experience when 
you call time.sleep(30) is not a value, so none of these things are 
objects. This is not to reduce the importance of these things as 
programming concepts, but they aren't the kind of things we mean when we 
say everything is an object.


-- 
Steven

[toc] | [prev] | [next] | [standalone]


#39853

FromMichael Torrie <torriem@gmail.com>
Date2013-02-24 18:34 -0700
Message-ID<mailman.2475.1361756055.2939.python-list@python.org>
In reply to#39798
On 02/24/2013 03:40 PM, Mitya Sirenef wrote:
> But if block doesn't have to be inside a function, right? It needs
> to be inside a module, but then again everything is inside a module, but
> it wouldn't be very object-oriented if the module was the only object in
> Python :-).

A module indeed fits into the OOP paradigm.  It's called a singleton and
I love the fact that I can define and use them in python without
wrapping them in tons of boilerplate class and factory code.

[toc] | [prev] | [next] | [standalone]


#39807

FromEthan Furman <ethan@stoneleaf.us>
Date2013-02-24 14:33 -0800
Message-ID<mailman.2447.1361745680.2939.python-list@python.org>
In reply to#39778
On 02/24/2013 12:58 PM, Chris Angelico wrote:
> On Mon, Feb 25, 2013 at 7:34 AM, Ethan Furman <ethan@stoneleaf.us> wrote:
>>
>>    - no variable declarations, just use 'em
>
> Variable declarations can go either way; Python requires you to name
> all globals that you mutate

I'm not sure what you mean -- example?

--
~Ethan~

[toc] | [prev] | [next] | [standalone]


#39818

FromAlbert Hopkins <marduk@letterboxes.org>
Date2013-02-24 18:32 -0500
Message-ID<mailman.2456.1361748768.2939.python-list@python.org>
In reply to#39778

> Most of what gets hung in art galleries these days is far less
> visually pleasing than well-written code.

+1 QOTW

[toc] | [prev] | [next] | [standalone]


#39821

FromChris Angelico <rosuav@gmail.com>
Date2013-02-25 10:44 +1100
Message-ID<mailman.2458.1361749463.2939.python-list@python.org>
In reply to#39778
On Mon, Feb 25, 2013 at 9:33 AM, Ethan Furman <ethan@stoneleaf.us> wrote:
> On 02/24/2013 12:58 PM, Chris Angelico wrote:
>>
>> On Mon, Feb 25, 2013 at 7:34 AM, Ethan Furman <ethan@stoneleaf.us> wrote:
>>>
>>>
>>>    - no variable declarations, just use 'em
>>
>>
>> Variable declarations can go either way; Python requires you to name
>> all globals that you mutate
>
>
> I'm not sure what you mean -- example?

Whoops, said the wrong thing. All globals that you assign to.

>>> a=1
>>> b=[]
>>> def foo(x):
	y=x+1
	global a
	a+=x
	b.append(y)	
>>> foo(2)
>>> a
3
>>> b
[3]

Python requires that you name 'a' in a global statement; C would
require a declaration for 'y' to make it local. PHP, meanwhile, would
require declarations for both a and b.

ChrisA

[toc] | [prev] | [next] | [standalone]


#39845

FromSteven D'Aprano <steve+comp.lang.python@pearwood.info>
Date2013-02-25 01:06 +0000
Message-ID<512ab919$0$29998$c3e8da3$5496439d@news.astraweb.com>
In reply to#39778
On Sun, 24 Feb 2013 11:40:05 -0800, piterrr.dolinski wrote:

>> > if (some statement):		# short form
>> >
>> > rather than
>> >
>> > if (some statement == true):	# long form
>> 
>> 
>> What all those ugly brackets are for?
>> 
>> 
> Mark,
> 
> Back in the day when C was king, or take many newer long established
> languages (C#, Java),

Python is older than either C# or Java. Why have those languages paid no 
attention to the innovations of Python, instead of copying the 
misfeatures of C?

Pascal and Algol and Fortran are older than C. Why did C introduce 
unnecessary brackets when these older languages did not need them?


> the use of () has been widespread and mandated by
> the compilers. I have never heard anyone moan about the requirement to
> use parentheses.

You have not been paying attention.

In many ways, C has been a curse on programming. It has trained large 
numbers of coders to expect and *demand* poor syntax.


> Now come Python in which parens are optional, and all
> of a sudden they are considered bad and apparently widely abandoned. Do
> you really not see that code with parens is much more pleasing visually?

That's funny. Perhaps you should be programming in Lisp.


> I could understand someone's reluctance to use parens if they are very
> new to programming and Pythons is their first language. But my
> impression here is that most group contributors are long-time
> programmers and have long used () where they are required. Again, I'm
> really surprised the community as a whole ignores the programming
> "heritage" and dumps the parens in a heartbeat.

(Because they are unnecessary) (visual noise) (that don't add anything) 
(useful) (to the reader's understanding) (of the code).



-- 
Steven

[toc] | [prev] | [next] | [standalone]


#39779

Frompiterrr.dolinski@gmail.com
Date2013-02-24 11:40 -0800
Message-ID<mailman.2426.1361735580.2939.python-list@python.org>
In reply to#39757
> > if (some statement):		# short form
> >
> > rather than
> >
> > if (some statement == true):	# long form
> 
> 
> What all those ugly brackets are for?
> 

Mark,

Back in the day when C was king, or take many newer long established languages (C#, Java), the use of () has been widespread and mandated by the compilers. I have never heard anyone moan about the requirement to use parentheses. Now come Python in which parens are optional, and all of a sudden they are considered bad and apparently widely abandoned. Do you really not see that code with parens is much more pleasing visually? I could understand someone's reluctance to use parens if they are very new to programming and Pythons is their first language. But my impression here is that most group contributors are long-time programmers and have long used () where they are required. Again, I'm really surprised the community as a whole ignores the programming "heritage" and dumps the parens in a heartbeat.

Peter

[toc] | [prev] | [next] | [standalone]


#39616

Frompiterrr.dolinski@gmail.com
Date2013-02-22 13:37 -0800
Message-ID<mailman.2304.1361569049.2939.python-list@python.org>
In reply to#39574
Thanks to everyone for all the posts, some friendly some not. I read all of them with genuine interest.

So I am continuing to learn Python, here are my new observations for your consideration.

There seems to be a "heated" argument about Python's apparently intentional ambiguity in conditional statements. Specifically, the issue is, is it more appropriate to write (as an example)

if (some statement):		# short form

rather than

if (some statement == true):	# long form

Some 50(?) years ago, C was designed so that everything other than 0 evaluated to true and was false otherwise. Fast forward to recent memory, when C# was designed, Microsoft claims they reviewed all the features of C, C++ and Java, pulled the best features from each of these languages and designed a new language that would help minimize the potential for planting bugs. Say what you want about MS inventions, but my experience is that to require the long form notation was a good decision. For me the fact that the short notation is legal in Python is a stepback in language design. Python inventors, when creating what is after all considered a contemporary language, should have known better. Call me psychopath if you will (have seen this in one post), but I shall continue to use the aforementioned long form as I always have, and no Python is going to change that.


Today I learned the hard way that all function parameters in Python are passed by reference (meaning whatever happens to them inside a function, new values are always passed to caller). Not good. I got caught up on this. To combat the mostly unwanted behavior, inside a function I have to reassign variables intended to be local to new variables. A pain. Can anyone offer ONE reason why Python was designed that way?

Out of curiosity, does anyone have any idea why function declarations are preceded by the keyword "def" rather than something more intuitive like "function" or at least "func", perhaps?

Does anyone know what the benefit of writing the cryptic "elif" to mean "else if" is? Curiously, the default statement in an if/else chain is preceded by "else" and not "el".

Someone said I am too narrow-sited appreciating C# and not open to alternate approaches to language design. Well if that someone says "def" is better than "function" and "elif" is better than "else if", then dare I say, you are obsessed with Python!

So far I am getting the impression that Python is a toy language of some kind (similar to Basic of the early 80's), not really suitable for serious work. The only difference between these languages (admittedly, a serious one) is the existence of extensive libraries. Otherwise there would be no good reason for Python to exist. Nevertheless, it does exist and I have to learn it. As long as someone is paying for my time, that's OK with me.

Peter

[toc] | [prev] | [next] | [standalone]


#39638

FromMitya Sirenef <msirenef@lightbird.net>
Date2013-02-22 20:05 -0500
Message-ID<mailman.2321.1361581532.2939.python-list@python.org>
In reply to#39554
On 02/22/2013 06:58 AM, Rui Maciel wrote:
> Mitya Sirenef wrote:
 >
 >> Looks very unclear and confusing to me. Whether it's C# or ruby or
 >> anything else, most devs don't indent like that;
 >
 > The Go programming language makes that style mandatory.
 >
 >
 > Rui Maciel


I was referring to different indentation of the if block, not to braces
style.  -m



-- 
Lark's Tongue Guide to Python: http://lightbird.net/larks/

The doer alone learneth.  Friedrich Nietzsche

[toc] | [prev] | [next] | [standalone]


#39686

FromGene Heskett <gheskett@wdtv.com>
Date2013-02-23 12:32 -0500
Message-ID<mailman.2357.1361640760.2939.python-list@python.org>
In reply to#39463
On Saturday 23 February 2013 12:03:00 Ethan Furman did opine:

> On 02/23/2013 07:51 AM, Chris Angelico wrote:
> > Steve, why do you say you're not a developer? A score of languages
> > under your belt, choosing to write code in your spare time, and
> > speaking competently on the comparative merits of different languages
> > and why you made the decision you made - sounds like you're every bit
> > a coder. Don't run yourself down so! :)
> 
> +1

I'll add another +1 to that.  My /main/ coding expertise, such as it is, is 
in assembly on the 6x09 cpu's.  Sure, I've done stuff in C, and in Basic09, 
but when I sit down to do a serious bit of code for that platform that 
doesn't need fancy trig functions, I do it in assembly.  Why?  The closer I 
can get to the hardware, the fewer surprises I find.  I can handle input 
errors for every possible error just by testing for legal input, and if not 
legal, branch to output a help screen to the dummy that cannot type.  Often 
me. :)  Quick stuff that does require some math gets done in basic09 which 
is good to about 8-9 digits, or calculating the next eclipse, based on 
julian dates, gets done in C where I have doubles and 17 digit floats 
available.

And I have quite a few bash scripts, often running as background daemons, 
that greatly simplicate my daily activities.  KMail for instance, doesn't 
have to take 2 minute timeouts while it fetches new mail is one of them. So 
my email is a matter of tapping the + key for the next message, replying if 
I want to & clicking send.  Everything else is automatic.  Ditto if I am 
working on the old machine & need a printout, I just send the text file 
from the assembler to device /p, and 15 seconds later a laser printer on 
that desk fires up and spits out my listing at 22 ppm. /p actually feeds a 
ser-usb adapter, its output is captured on this machine, sent to cups for 
rendering & sent back down the same cable to the printer also plugged into 
that usb hub.  To me there is zero point in having to stop & look up the 
command line syntax to drive lp with a 100 character command line when 
except for the filename to print, it never changes.  Put it in a bash 
script that doesn't make typu's.

So I am a programmer in that sense, just not at the level of abstraction 
that python has to offer.

I am here because I was hoping some knowledge leakage would help me to 
understand python, but at my age I am beginning to have to admit the level 
of abstraction is something I may never fully grok.  If I ever find a 
python book that literally starts at square one, it _will_ come home with 
me though.

But I have too many hobbies too, I have a BP rifle that needs a trip to the 
range this afternoon for some exercise. :)

Cheers, Gene
-- 
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
My web page: <http://coyoteden.dyndns-free.com:85/gene> is up!
My views 
<http://www.armchairpatriot.com/What%20Has%20America%20Become.shtml>
The telephone is a good way to talk to people without having to offer
them a drink.
		-- Fran Lebowitz, "Interview"
I was taught to respect my elders, but its getting 
harder and harder to find any...

[toc] | [prev] | [next] | [standalone]


#39690

FromSteve Simmons <square.steve@gmail.com>
Date2013-02-23 19:10 +0100
Message-ID<mailman.2361.1361643058.2939.python-list@python.org>
In reply to#39463
On 23/02/2013 18:32, Gene Heskett wrote:
> I am here because I was hoping some knowledge leakage would help me to 
> understand python, but at my age I am beginning to have to admit the 
> level of abstraction is something I may never fully grok. If I ever 
> find a python book that literally starts at square one, it _will_ come 
> home with me though. But I have too many hobbies too, I have a BP 
> rifle that needs a trip to the range this afternoon for some exercise. 
> :) Cheers, Gene 
I'm using Rapid GUI Programming with Python & Qt (Mark Summerfield ISBN 
978-0-13-235418-9) - it fits for me because I needed something that 
covered GUI development but also had an intro to the language.  The 
first 3 chapters are a Python intro at a sensible level for experienced 
coders (none of this 'here is the keyboard, there is the screen' 
nonsense) so it is enough to get you going with Python. The rest is 
about Qt/PyQt, taught via manageable examples and giving a fairly well 
thought out dialogue (monologue?) of what each line/function does.   It 
was useful enough for me to want to carry the hardback version with me 
on my 'commute' from the UK to Nigeria where I am currently working.  
I've also got two books by Wesley Chun, (Core Python Programming & Core 
Python Applications Programming) on my Kindle .  I can't give you a 
sensible verdict on those two because, while I've finally settled to 
reading fiction on the Kindle, I still like to have a real book when it 
comes to reference works (on any subject) so they haven't had the usage 
that Summerfield has.

Oh, and you're never too old for anything but most things take longer - 
gives you more time to enjoy them ;-)

[toc] | [prev] | [next] | [standalone]


#39697

FromMichael Torrie <torriem@gmail.com>
Date2013-02-23 11:40 -0700
Message-ID<mailman.2366.1361644869.2939.python-list@python.org>
In reply to#39463
On 02/21/2013 02:26 PM, 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?

Well I never use tabs in python files and I don't expect any python
source code file to either.  Any that do I consider to be a bug.

But as for whitespace syntax formatting in general, I love it.
Executable pseudo-code makes for more rapid development (and fewer
errors) than in any language I have used to date.

[toc] | [prev] | [next] | [standalone]


#39705

FromMichael Torrie <torriem@gmail.com>
Date2013-02-23 12:15 -0700
Message-ID<mailman.2372.1361646915.2939.python-list@python.org>
In reply to#39463
On 02/23/2013 11:10 AM, Steve Simmons wrote:
> I'm using Rapid GUI Programming with Python & Qt (Mark Summerfield ISBN 
> 978-0-13-235418-9) - it fits for me because I needed something that 
> covered GUI development but also had an intro to the language.  

Sounds fun.  One thing about PyQt is that it's really just C++ thinly
wrapped in python calls.  It's not really that pythonic.  PySide looks
to be a bit better, with more pythonic ways of interacting with things
(iteration, etc).

[toc] | [prev] | [next] | [standalone]


#39717

FromGene Heskett <gheskett@wdtv.com>
Date2013-02-23 17:49 -0500
Message-ID<mailman.2383.1361659793.2939.python-list@python.org>
In reply to#39463
On Saturday 23 February 2013 17:44:21 Steve Simmons did opine:

> On 23/02/2013 18:32, Gene Heskett wrote:
> > I am here because I was hoping some knowledge leakage would help me to
> > understand python, but at my age I am beginning to have to admit the
> > level of abstraction is something I may never fully grok. If I ever
> > find a python book that literally starts at square one, it _will_ come
> > home with me though. But I have too many hobbies too, I have a BP
> > rifle that needs a trip to the range this afternoon for some exercise.
> > 
> > :) Cheers, Gene
> 
> I'm using Rapid GUI Programming with Python & Qt (Mark Summerfield ISBN
> 978-0-13-235418-9) - it fits for me because I needed something that
> covered GUI development but also had an intro to the language.  The
> first 3 chapters are a Python intro at a sensible level for experienced
> coders (none of this 'here is the keyboard, there is the screen'
> nonsense) so it is enough to get you going with Python. The rest is
> about Qt/PyQt, taught via manageable examples and giving a fairly well
> thought out dialogue (monologue?) of what each line/function does.   It
> was useful enough for me to want to carry the hardback version with me
> on my 'commute' from the UK to Nigeria where I am currently working.
> I've also got two books by Wesley Chun, (Core Python Programming & Core
> Python Applications Programming) on my Kindle .  I can't give you a
> sensible verdict on those two because, while I've finally settled to
> reading fiction on the Kindle, I still like to have a real book when it
> comes to reference works (on any subject) so they haven't had the usage
> that Summerfield has.
> 
> Oh, and you're never too old for anything but most things take longer -
> gives you more time to enjoy them ;-)

Humm, but what if you are worrying about having enough time just to finish 
a bucket list?  However, there so much in my bucket, I doubt if I'll ever 
see the bottom of it.  And of course, looking at it from my side of these 
trifocals, the real question is should I put a smiley, or a frowny after 
it, so I'll not confuse the issue by doing either.

Cheers, Gene
-- 
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
My web page: <http://coyoteden.dyndns-free.com:85/gene> is up!
My views 
<http://www.armchairpatriot.com/What%20Has%20America%20Become.shtml>
Our missions are peaceful -- not for conquest.  When we do battle, it
is only because we have no choice.
		-- Kirk, "The Squire of Gothos", stardate 2124.5
I was taught to respect my elders, but its getting 
harder and harder to find any...

[toc] | [prev] | [next] | [standalone]


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

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


csiph-web