How to write fast into a file in python?

Carlos Nepomuceno carlosnepomuceno at outlook.com
Mon May 20 06:34:56 EDT 2013


Oh well! Just got a flashback from the old times at the 8-bit assembly line.

Dirty deeds done dirt cheap! lol

----------------------------------------
> Date: Sun, 19 May 2013 16:44:55 +0100
> From: python at mrabarnett.plus.com
> To: python-list at python.org
> Subject: Re: How to write fast into a file in python?
>
> On 19/05/2013 04:53, Carlos Nepomuceno wrote:
>> ----------------------------------------
>>> Date: Sat, 18 May 2013 22:41:32 -0400
>>> From: davea at davea.name
>>> To: python-list at python.org
>>> Subject: Re: How to write fast into a file in python?
>>>
>>> On 05/18/2013 01:00 PM, Carlos Nepomuceno wrote:
>>>> Python really writes '\n\r' on Windows. Just check the files.
>>>
>>> That's backwards. '\r\n' on Windows, IF you omit the b in the mode when
>>> creating the file.
>>
>> Indeed! My mistake just made me find out that Acorn used that inversion on Acorn MOS.
>>
>> According to this[1] (at page 449) the OSNEWL routine outputs '\n\r'.
>>
>> What the hell those guys were thinking??? :p
>>
> Doing it that way saved a few bytes.
>
> Code was something like this:
>
> FFE3 .OSASCI CMP #&0D
> FFE5 BNE OSWRCH
> FFE7 .OSNEWL LDA #&0A
> FFE9 JSR OSWRCH
> FFEC LDA #&0D
> FFEE .OSWRCH ...
>
> This means that the contents of the accumulator would always be
> preserved by a call to OSASCI.
>
>> "OSNEWL
>> This call issues an LF CR (line feed, carriage return) to the currently selected
>> output stream. The routine is entered at &FFE7."
>>
>> [1] http://regregex.bbcmicro.net/BPlusUserGuide-1.07.pdf
>>
>
> --
> http://mail.python.org/mailman/listinfo/python-list 		 	   		  


More information about the Python-list mailing list