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


Groups > comp.lang.python > #30024

Re: python file API

From Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de>
Newsgroups comp.lang.python
Subject Re: python file API
Date 2012-09-25 07:32 +0200
Organization A newly installed InterNetNews server
Message-ID <k3rflf$ppk$2@r03.glglgl.gl> (permalink)
References <0ec1fe2e-890c-4e25-8047-4cb8bee0aa95@googlegroups.com> <5060D55C.3000407@davea.name> <CAPTjJmpHaprEcemVP+7mwNf2XL=_x60Ye7V3-fQ_Fik=1do5Mw@mail.gmail.com> <mailman.1229.1348526265.27098.python-list@python.org>

Show all headers | View raw


Am 25.09.2012 00:37 schrieb Ian Kelly:
> On Mon, Sep 24, 2012 at 4:14 PM, Chris Angelico<rosuav@gmail.com>  wrote:
>> file.pos = 42 # Okay, you're at position 42
>> file.pos -= 10 # That should put you at position 32
>> foo = file.pos # Presumably foo is the integer 32
>> file.pos -= 100 # What should this do?
>
> Since ints are immutable, the language specifies that it should be the
> equivalent of "file.pos = file.pos - 100", so it should set the file
> pointer to 68 bytes before EOF.

But this is not a "real int", it has a special use. So I don't think it 
is absolutely required to behave like an int.

This reminds me of some special purpose registers in embedded 
programming, where bits can only be set by hardware and are cleared by 
the application by writing 1 to them.

Or some bit setting registers, like on ATxmega: OUT = 0x10 sets bit 7 
and clears all others, OUTSET = 0x10 only sets bit 7, OUTTGL = 0x10 
toggles it and OUTCLR = 0x10 clears it.

If this behaviour is documented properly enough, it is quite OK, IMHO.


Thomas

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

python file API zipher <dreamingforward@gmail.com> - 2012-09-24 14:35 -0700
  Re: python file API Dave Angel <d@davea.name> - 2012-09-24 17:49 -0400
    Re: python file API Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2012-09-25 08:22 +0200
      Re: python file API Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-09-25 04:19 -0400
        Re: python file API Grant Edwards <invalid@invalid.invalid> - 2012-09-25 14:07 +0000
      Re: python file API Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-09-25 12:07 -0400
      Re: python file API Chris Angelico <rosuav@gmail.com> - 2012-09-26 02:12 +1000
  Re: python file API Chris Kaynor <ckaynor@zindagigames.com> - 2012-09-24 14:58 -0700
  Re: python file API Chris Angelico <rosuav@gmail.com> - 2012-09-25 08:14 +1000
    Re: python file API zipher <dreamingforward@gmail.com> - 2012-09-24 15:36 -0700
      Re: python file API Mark Adam <dreamingforward@gmail.com> - 2012-09-24 21:32 -0500
      Re: python file API Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-09-25 08:27 +0100
      Re: python file API Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-09-25 11:51 +0100
    Re: python file API zipher <dreamingforward@gmail.com> - 2012-09-24 15:36 -0700
      Re: python file API Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-09-25 02:28 +0000
        Re: python file API Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2012-09-25 07:25 +0200
          Re: python file API Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-09-25 07:28 +0000
            Re: python file API Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2012-09-25 21:40 +0200
    Re: python file API Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-09-25 01:33 +0000
  Re: python file API Dave Angel <d@davea.name> - 2012-09-24 18:36 -0400
  Re: python file API Ian Kelly <ian.g.kelly@gmail.com> - 2012-09-24 16:37 -0600
    Re: python file API Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2012-09-25 07:32 +0200
      Re: python file API Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-09-25 04:13 -0400
        Re: python file API Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2012-09-25 11:53 +0200
      Re: python file API Ian Kelly <ian.g.kelly@gmail.com> - 2012-09-25 03:32 -0600
  Re: python file API Chris Angelico <rosuav@gmail.com> - 2012-09-25 08:57 +1000
  Re: python file API Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-09-25 00:12 +0100
  Re: python file API Chris Kaynor <ckaynor@zindagigames.com> - 2012-09-24 16:14 -0700
  Re: python file API Ramchandra Apte <maniandram01@gmail.com> - 2012-09-30 05:50 -0700

csiph-web