what does := means simply?

bartc bc at freeuk.com
Sun May 20 07:38:59 EDT 2018


On 20/05/2018 10:19, Peter J. Holzer wrote:
> On 2018-05-19 13:43:14 +0100, bartc wrote:

>> Text files, yes. Not 'text mode' which is something inflicted on us by the C
>> library.
> 
> I very much enjoy the fact that the programming languages I've used to
> process text files in the last 15 years (i.e. Perl and Python) can
> convert just about any character encoding and any newline convention to
> a canonical representation with a single parameter to open.

And I quite like the fact that I have complete control over what is 
being read or written. And if there is some obscure bug, that the actual 
contents of a file aren't hidden behind some protocols in library.

> When the "textmode" in the C library was invented (it wasn't just C,
> though: Wirth's Modula-2 book describes a remarkably similar mechanism)

I also like the way that the single '\n' character in a source file 
conveniently matches the single '\n' character used by Unix. So no 
translation of any kind is needed, and you can assume that if you write 
1000 empty lines the output file will be 1000 bytes long.

The complications are in all the other operating systems. And the bugs 
when someone assumes that one '\n' in a program equals one 10 byte in a 
file, will only occur on those other systems.

> The premise in your previous message was that you are on an EBCDIC based
> system (and a quite limited at that which doesn't even have a character
> set conversion library, so you would have to program the character set
> conversion yourself). So you can't cop out with "I don't care about
> EBCDIC based systems".

I think it was Steven D'Aprano who brought up EBCDIC. And not seriously.

> (Your single readln wouldn't work reliably on ASCII systems either,
> since - as others have already pointed out - the header format of a PPM
> file isn't quite as simple as you imagine).

The line-reading has to be in a loop in order to skip comments, which I 
didn't show because the bigger obstacle in Python appeared to be reading 
the numbers (and is not needed for those specific Mandelbrot images). 
It's something like this: repeat ... until width.isint

> A PPM reader for an EBCDIC system will certainly be able to read PPM
> files on an EBCDIC system. Why would anybody write and release software
> which doesn't work on the intended target system?

Then the /same software/ probably wouldn't work anywhere else. I mean 
taking source which doesn't know or care about what system its on, and 
that operates on a ppm file downloaded from the internet.

-- 
bartc



More information about the Python-list mailing list