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


#39855

FromOscar Benjamin <oscar.j.benjamin@gmail.com>
Date2013-02-25 01:44 +0000
Message-ID<mailman.2477.1361756708.2939.python-list@python.org>
In reply to#39826
On 25 February 2013 01:24, Chris Angelico <rosuav@gmail.com> wrote:
> On Mon, Feb 25, 2013 at 11:45 AM, Oscar Benjamin
> <oscar.j.benjamin@gmail.com> wrote:
>> On 25 February 2013 00:08,  <piterrr.dolinski@gmail.com> wrote:
>> Chris Angelico wrote:
>>>> For example (I believe it's already been mentioned) "declaring" intX with some integer value does *nothing* to maintain
>>>>
>>>> X as an integer:
>>>>
>>>> --> intX = 32
>>>>
>>>> --> intX = intX / 3.0
>>>>
>>>> --> intX
>>>>
>>>> 10.6666666666
>>>>
>>>
>>> Yes I did see that it is possible to redefine the type of a variable. But I don't think I would ever do this intentionally; need to be really careful with Python.
>
>> The trickier cases are ones where two types are very similar and can
>> be used similarly in most, but not all, situations. An example of this
>> would be the one that Chris has highlighted where an object that you
>> expected to be an int is actually a float. I find that I need to be
>> careful when using division on quantities that I expected to be
>> integers (true in all languages) and careful about the notation used
>> in a numeric literal. Once you get used to it, you will find it easy
>> to see that the '.0' that Chris appended was deliberate in order to
>> control the type of the resulting object.
>
> Once again, Ethan gets the short end of the citations stick...
> 'twarn't me wrote that, he did. Not that it's at all contrary to my
> views, and I might well have said it if he hadn't, but credit should
> go his direction :)

Apologies to you both. The information was missing and I attempted to
fill it in but got it wrong.

> Note though that in Python 3, you don't need the explicit .0 to force
> it to float (and __future__ can bring that to Python 2 too). 32/3 ->
> 10.66666, int/int->float.

That's true and I'm very glad of this change in Python 3. However
other issues of float/int ambiguity remain for those (like me) who are
particularly concerned with numbers and their accuracy/exactness. So
it is still necessary in Python 3 to be careful around this issue.
While it is an issue in all languages, it is one that is often easier
to deal with in statically typed languages than in Python.


Oscar

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


#39856

FromChris Angelico <rosuav@gmail.com>
Date2013-02-25 12:53 +1100
Message-ID<mailman.2478.1361757228.2939.python-list@python.org>
In reply to#39826
On Mon, Feb 25, 2013 at 12:44 PM, Oscar Benjamin
<oscar.j.benjamin@gmail.com> wrote:
> On 25 February 2013 01:24, Chris Angelico <rosuav@gmail.com> wrote:
>> Once again, Ethan gets the short end of the citations stick...
>> 'twarn't me wrote that, he did. Not that it's at all contrary to my
>> views, and I might well have said it if he hadn't, but credit should
>> go his direction :)
>
> Apologies to you both. The information was missing and I attempted to
> fill it in but got it wrong.

I know, it's not easy; one person omits the citation line, another
quotes that person and doesn't have the proper context. It's just odd
that Ethan got short-changed twice in one thread across a few hours.
Is the community trying to pretend he doesn't exist? :)

ChrisA

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


#39862

FromMRAB <python@mrabarnett.plus.com>
Date2013-02-25 02:23 +0000
Message-ID<mailman.2482.1361758999.2939.python-list@python.org>
In reply to#39826
On 2013-02-25 01:53, Chris Angelico wrote:
> On Mon, Feb 25, 2013 at 12:44 PM, Oscar Benjamin
> <oscar.j.benjamin@gmail.com> wrote:
>> On 25 February 2013 01:24, Chris Angelico <rosuav@gmail.com> wrote:
>>> Once again, Ethan gets the short end of the citations stick...
>>> 'twarn't me wrote that, he did. Not that it's at all contrary to my
>>> views, and I might well have said it if he hadn't, but credit should
>>> go his direction :)
>>
>> Apologies to you both. The information was missing and I attempted to
>> fill it in but got it wrong.
>
> I know, it's not easy; one person omits the citation line, another
> quotes that person and doesn't have the proper context. It's just odd
> that Ethan got short-changed twice in one thread across a few hours.
> Is the community trying to pretend he doesn't exist? :)
>
Pretend that who doesn't exist? :-)

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


#39869

FromEthan Furman <ethan@stoneleaf.us>
Date2013-02-24 18:59 -0800
Message-ID<mailman.2487.1361762182.2939.python-list@python.org>
In reply to#39826
On 02/24/2013 05:53 PM, Chris Angelico wrote:
> On Mon, Feb 25, 2013 at 12:44 PM, Oscar Benjamin
> <oscar.j.benjamin@gmail.com> wrote:
>> On 25 February 2013 01:24, Chris Angelico <rosuav@gmail.com> wrote:
>>> Once again, Ethan gets the short end of the citations stick...
>>> 'twarn't me wrote that, he did. Not that it's at all contrary to my
>>> views, and I might well have said it if he hadn't, but credit should
>>> go his direction :)
>>
>> Apologies to you both. The information was missing and I attempted to
>> fill it in but got it wrong.
>
> I know, it's not easy; one person omits the citation line, another
> quotes that person and doesn't have the proper context. It's just odd
> that Ethan got short-changed twice in one thread across a few hours.
> Is the community trying to pretend he doesn't exist? :)

Exist?  I exist?  Hey, no!  Let me typ[CARRIER LOST]

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


#39827

Frompiterrr.dolinski@gmail.com
Date2013-02-24 16:08 -0800
Message-ID<mailman.2462.1361750895.2939.python-list@python.org>
In reply to#39824
> For example (I believe it's already been mentioned) "declaring" intX with some integer value does *nothing* to maintain 
> 
> X as an integer:
> 
> --> intX = 32
> 
> --> intX = intX / 3.0
> 
> --> intX
> 
> 10.6666666666
> 

Yes I did see that it is possible to redefine the type of a variable. But I don't think I would ever do this intentionally; need to be really careful with Python.

Peter

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


#39834

FromRoy Smith <roy@panix.com>
Date2013-02-24 19:42 -0500
Message-ID<roy-A10B96.19422124022013@news.panix.com>
In reply to#39824
In article <mailman.2461.1361749985.2939.python-list@python.org>,
 Ethan Furman <ethan@stoneleaf.us> wrote:

> On 02/24/2013 03:38 PM, piterrr.dolinski@gmail.com wrote:
> >
> >>> intX = 32                          # decl + init int var
> >> How is it not obvious that "intX" is an integer *without* the comment?
> >
> > Indeed the assignment is enough to deduce "intX" is an int. The comment is 
> > there to let me know it is unlikely intX appears earlier in the code. 
> > Please, let me do things my way until I find reasons to the contrary.
> 
> Of course you can, but wouldn't you rather find reasons to the contrary by us 
> telling you, instead of tripping
> over something yourself?
> 
> For example (I believe it's already been mentioned) "declaring" intX with 
> some integer value does *nothing* to maintain 
> X as an integer:
> 
> --> intX = 32
> --> intX = intX / 3.0
> --> intX
> 10.6666666666

I could imagine a getattr-based implementation of DBC (Design By 
Contract) which does use the variable name to enforce type.  Unclear if 
this is a Good Thing, a Bad Thing, or a just plain Crazy Thing.  In any 
cae, it would be a neat (if somewhat advanced) exercise for somebody 
interested in enforcing types and looking to explore some of the more 
arcane corners of Python.

class DBC_Example:
   # Ad-libbing this, code not tested
   def __setattr__(self, name, value):
      if name.startswith('int'):
         assert isinstance(value, int)
      self.__dict__[name] = value

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


#39820

Frompiterrr.dolinski@gmail.com
Date2013-02-24 15:38 -0800
Message-ID<mailman.2457.1361749140.2939.python-list@python.org>
In reply to#39816
>> intX = 32                          # decl + init int var
> How is it not obvious that "intX" is an integer *without* the comment?

Indeed the assignment is enough to deduce "intX" is an int. The comment is there to let me know it is unlikely intX appears earlier in the code. Please, let me do things my way until I find reasons to the contrary.

Regarding my use of None to mean NULL, point taken to use "" instead.

Peter

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


#39817

FromJoshua Landau <joshua.landau.ws@gmail.com>
Date2013-02-24 23:21 +0000
Message-ID<mailman.2455.1361748133.2939.python-list@python.org>
In reply to#39777

[Multipart message — attachments visible in raw view] — view raw

On 24 February 2013 23:18, Oscar Benjamin <oscar.j.benjamin@gmail.com>wrote:

> On 24 February 2013 21:35, Joshua Landau <joshua.landau.ws@gmail.com>
> wrote:
> >
> > determinant = b**2 - 4*a*c
>
> It's called the discriminant. A determinant is something altogether
> different.


*cries at own idiocy*

Thank you.

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


#39811

FromDave Angel <davea@davea.name>
Date2013-02-24 17:47 -0500
Message-ID<mailman.2450.1361746071.2939.python-list@python.org>
In reply to#39750
On 02/24/2013 10:46 AM, piterrr.dolinski@gmail.com wrote:
> Hi guys,
>
> Question. Have this code
>
> intX = 32                          # decl + init int var
> intX_asString = None               # decl + init with NULL string var

None is not a str, and it's not a "NULL string var"   Perhaps what you 
want is intX_asString = ""

 > I am using a Python IDE called PyScripter. Its Intellisense is full
 > of methods starting and ending with "__", hence the question.

I'm surprised;  I'd expect the Intellisense to filter those out by 
default, since people seldom should call them.

-- 
DaveA

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


#39889

FromSerhiy Storchaka <storchaka@gmail.com>
Date2013-02-25 14:40 +0200
Message-ID<mailman.2502.1361796024.2939.python-list@python.org>
In reply to#39750
On 24.02.13 17:52, Chris Angelico wrote:
> By the way, when you're asking a completely new question, it usually
> helps to do so as a brand new thread (not a reply) and with a new
> subject line. Otherwise, you risk people losing the new question among
> the discussion of the old.

You risk people losing your answer when you're answering such question.

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


#39751

Frompiterrr.dolinski@gmail.com
Date2013-02-24 07:46 -0800
Message-ID<mailman.2409.1361720771.2939.python-list@python.org>
In reply to#39746
Hi guys,

Question. Have this code

intX = 32                          # decl + init int var
intX_asString = None               # decl + init with NULL string var

intX_asString = intX.__str__ ()    # convert int to string

What are these ugly underscores for? _________________str___________________

Peter

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


#39735

FromMichael Torrie <torriem@gmail.com>
Date2013-02-23 22:23 -0700
Message-ID<mailman.2395.1361683389.2939.python-list@python.org>
In reply to#39722
On 02/23/2013 04:46 PM, piterrr.dolinski@gmail.com wrote:
> Yes, it's true that I am trying to write C# code in Python. It is not
> going to change any time soon, if at all - I have done too much
> C#ing, C++ing before that and C-ing earlier still. 

Unfortunately as long as do, you'll find Python a less-than-satisfying
experience.

And I'm a bit surprised too because if you tried to program C# as you
would C++, you'd likely also be frustrated.  C, C++, and C# all demand
different programming paradigms and even styles (despite the similarity
in the braces).  Yet you got used to that.

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


#39724

FromMRAB <python@mrabarnett.plus.com>
Date2013-02-24 00:11 +0000
Message-ID<mailman.2388.1361664709.2939.python-list@python.org>
In reply to#39627
On 2013-02-23 23:18, Chris Angelico wrote:
> On Sun, Feb 24, 2013 at 9:52 AM, Michael Torrie <torriem@gmail.com> wrote:
>> On 02/23/2013 02:38 PM, Chris Angelico wrote:
>>> On Sun, Feb 24, 2013 at 5:29 AM, Dennis Lee Bieber
>>> <wlfraed@ix.netcom.com> wrote:
>>>>         Error codes under DEC VAX/VMS used odd integers for
>>>> "success/information" and even integers for "warning/error" (been too
>>>> many years, I think positive integers were success/warning, negative
>>>> integers were information/error; I could also be wrong on which set were
>>>> even... if 0 were no-info/success then odd were errors and even were
>>>> success)).
>>>
>>> Sounds like IBM DB2 and sqlca.sqlcode - 0 for success, <0 for error,
>>>> 0 for warning (or in some cases "status" - an SQLCODE of 100 means
>>> "end of result set", which isn't exactly an error but you can't fetch
>>> any more from it; it's akin to Python raising StopIteration to
>>> terminate a for loop).
>>
>> All apps that return an error code to the operating system return 0 for
>> success, any other value for error.  All command-line utilities work
>> this way, all shells, etc.  Even Windows command-line apps work this way
>> (errorlevel is what they call it).
>
> Yep, the 0 = success part is pretty much universal (it's been said
> that the cause of the downfall of the Roman empire was that, lacking
> zero, they were unable to succeed at anything), but the notion of
> negative for errors and positive for warnings isn't as clear;
> errorlevels and Unix return codes are positive-only.
>
...although some C functions return a negative error code because a
non-negative value is the number of characters written.

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


#39760

FromDennis Lee Bieber <wlfraed@ix.netcom.com>
Date2013-02-24 12:37 -0500
Message-ID<mailman.2418.1361727431.2939.python-list@python.org>
In reply to#39627
On Sat, 23 Feb 2013 15:52:31 -0700, Michael Torrie <torriem@gmail.com>
declaimed the following in gmane.comp.python.general:

> 
> All apps that return an error code to the operating system return 0 for
> success, any other value for error.  All command-line utilities work
> this way, all shells, etc.  Even Windows command-line apps work this way
> (errorlevel is what they call it).

	Decided to look up the VAX/VMS scheme...

"""
If you know the condition code for a message, you can use F$MESSAGE to
translate the code to its associated message. For example:
$ WRITE SYS$OUTPUT F$MESSAGE(%X00000001)
%SYSTEM-S-NORMAL, normal successful completion
"""

	VMS used a status of "1" for normal success (which implies that all
the odd integers were success/info messages, even integers would be
warning/error/fatal.

http://h71000.www7.hp.com/doc/73final/documentation/pdf/ovms_msg_ref_al.pdf
-- 
	Wulfraed                 Dennis Lee Bieber         AF6VN
        wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/

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


#39764

FromMichael Torrie <torriem@gmail.com>
Date2013-02-24 10:56 -0700
Message-ID<mailman.2420.1361728619.2939.python-list@python.org>
In reply to#39627
On 02/24/2013 10:37 AM, Dennis Lee Bieber wrote:
> 	Decided to look up the VAX/VMS scheme...
> 
> """
> If you know the condition code for a message, you can use F$MESSAGE to
> translate the code to its associated message. For example:
> $ WRITE SYS$OUTPUT F$MESSAGE(%X00000001)
> %SYSTEM-S-NORMAL, normal successful completion
> """
> 
> 	VMS used a status of "1" for normal success (which implies that all
> the odd integers were success/info messages, even integers would be
> warning/error/fatal.
> 
> http://h71000.www7.hp.com/doc/73final/documentation/pdf/ovms_msg_ref_al.pdf

It's interesting to note that Windows NT sort of descends from VMS.  I
guess the end result was an unholy blend of VMS and CP/M.

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


#39765

FromRoy Smith <roy@panix.com>
Date2013-02-24 13:07 -0500
Message-ID<roy-6665CF.13072724022013@news.panix.com>
In reply to#39764
In article <mailman.2420.1361728619.2939.python-list@python.org>,
 Michael Torrie <torriem@gmail.com> wrote:

> It's interesting to note that Windows NT sort of descends from VMS.

More than "sort of".  Dave Cutler was the chief architect of both.

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


#39858

FromDennis Lee Bieber <wlfraed@ix.netcom.com>
Date2013-02-24 21:01 -0500
Message-ID<mailman.2480.1361757708.2939.python-list@python.org>
In reply to#39627
On Sun, 24 Feb 2013 10:56:53 -0700, Michael Torrie <torriem@gmail.com>
declaimed the following in gmane.comp.python.general:

> 
> It's interesting to note that Windows NT sort of descends from VMS.  I
> guess the end result was an unholy blend of VMS and CP/M.

	Pity they didn't take the "good parts" of VMS...

	Interprocess communication via "mailboxes" would have been nice...
More general than UNIX-style "pipes", as once the mailbox has been
created, multiple processes could connect for read or write in parallel.
Processes don't have to be blocked by mailbox I/O...

-- 
	Wulfraed                 Dennis Lee Bieber         AF6VN
        wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/

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


#39628

Frompiterrr.dolinski@gmail.com
Date2013-02-22 15:38 -0800
Message-ID<mailman.2313.1361576864.2939.python-list@python.org>
In reply to#39621
Hi Ian,

Thanks for typing all this for me. Really useful. I did some googling of my own and I found that there was no concept of boolean in older versions of Python like you said. (BTW, how does this omission go well with proper language design, as Oscar seems to have hinted?) I think this obvious shortcomming is the main reason that, for example, when x holds the value of 5, x is considered to be "true". You see, I have to maintain Python files (ubuntu server scripts) which are 2000 lines long, all sequential code, no functions. While the person who wrote them should be shot :), the fact that there is inherent ambiguity with value, none, null 0, you name it, in conditional statements is not helping me understand the code, and this adds to my frustration.


I messed up my

if (some statement):            # short form

in the example I gave, but you figured exactly what I mean. Of course if the condition (some statement) is boolean there is no point adding "== true" or similar. But if (some statement) represents a value this is where I have trouble and again the origins of this date back to when Python had no boolean type. So now at least I understand it.

Btw, there are still languages with no boolean type today, MySQL for one. This creates big efficiency problems when fetching data from the database into a C# program - what should be a bool is fetched as an 8-byte integer! But that's a different story. I shut up now.

As I said I am new to Python, learning it, I have to get more experience with passing parameter values to functions, as I do with mostly everything else.

Cheers.

Peter

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


#39637

FromTerry Reedy <tjreedy@udel.edu>
Date2013-02-22 20:04 -0500
Message-ID<mailman.2320.1361581500.2939.python-list@python.org>
In reply to#39615
On 2/22/2013 4:37 PM, piterrr.dolinski@gmail.com wrote:

Yours is the first post here, that I know of, from someone 'forced' to 
learn and use Python at their job. Several people have instead 
complained about being prohibited from using Python at work. I am sorry 
that you have been introduced to it in such a poor way.

I am doubly sorry that your first Python job is to work with a monstrous 
script that most of us would likely also hate. I am sure anyone 
responding here would have split 2000 lines into multiple  testable 
functions even if every function was called just once (other than in the 
test code).

I came to Python from C. It took me about 2 weeks to grok the difference 
between being object based and memory-block based. I am glad someone who 
knows something of C# could say more.

About 'if obj: pass'. Simplifying just a bit, the interpreter executes 
that internally as 'if obj.__bool__() ...'. It adds the implicit call so 
you do not have to write it, or an equivalent expression. For each 
class, the method gives an appropriate default classification. For 
numbers, 'if x' means 'if x != 0'. For collections, 'if c' means 'if 
len(c) != 0'. Once one gets used to it, it is a great saving in writing 
and reading. If the default classification is not the one you want, you 
write an explicit expression that is the one you want.

I too would have preferred fun or func, but I live with def.

As for function calling, forget 'pass by value' versus 'pass by 
reference'. Both mislead in certain situations.

x = y+3

computes an object from 'y+3', looking up name 'y' in the current 
namespaces, and associates the object with name 'x' in the current local 
namespace. (This assumes the default situation with no 'global x' or 
'nonlocal x' declarations.)

def f(x): return 2*x
f(y+3)

computes an object from 'y+3' looking up name 'y' in the current 
namespaces, makes the local namespace of f the current local namespace, 
and associates the object with the name 'x' in the new local namespace.

Toy? I think the first 'killer app' for Python was nuclear weapon 
calculations at U.S. National Labs (Livermore and Los Alamos), where 
numerical python started. The current version, numpy, along with scipy 
and many other packages, is used throughout the sciences.

On the other hand, Python is the most fun language for most of us, so in 
that sense it's a great toy. And I also think it a great replacement for 
Basic.

-- 
Terry Jan Reedy

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


#39645

Fromrurpy@yahoo.com
Date2013-02-22 18:48 -0800
Message-ID<14842819-712e-4b0d-910f-27fef84f6046@googlegroups.com>
In reply to#39637
On Friday, February 22, 2013 6:04:21 PM UTC-7, Terry Reedy wrote:
>[...] the first 'killer app' for Python was nuclear weapon calculations...

Gives a whole new meaning to the phrase "killer app", doesn't it?

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


Page 5 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