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


Groups > comp.programming > #16325

Re: Scanning

From Richard Heathfield <rjh@cpax.org.uk>
Newsgroups comp.programming
Subject Re: Scanning
Date 2023-01-19 15:06 +0000
Organization Fix this later
Message-ID <tqbm8u$1hm7b$1@dont-email.me> (permalink)
References <Scanning-20230119123241@ram.dialup.fu-berlin.de> <scanner-20230119154238@ram.dialup.fu-berlin.de>

Show all headers | View raw


On 19/01/2023 2:48 pm, Stefan Ram wrote:
> ram@zedat.fu-berlin.de (Stefan Ram) writes:
>> Let's take a very simple task: This scanner for text files
>> has nothing more to do than to return every character,
>> except to strip the spaces at the end of a line.
> 
>    Richard said that it matters what I need this for.
> 
>    I'd like to implement a tiny markup language

Okay, BIG job with lots of complicated, so strive to keep each 
part relatively simple if you ever hope to get it working. Do it 
in whatever way comes most natural to your programming style, 
because that's how /you/ can define 'simple'. You're using 
Python, so I guess you're not overly concerned by performance, so 
do it the way you personally find easiest. I'm guessing you'll go 
for line by line and lean on Python's memory management.

But write this down somewhere: if, further down the line, your 
parser turns out to be too slow and the profiler blames this bit, 
rewriting it to go byte by byte might well be one of the ways you 
could speed it up.

-- 
Richard Heathfield
Email: rjh at cpax dot org dot uk
"Usenet is a strange place" - dmr 29 July 1999
Sig line 4 vacant - apply within

Back to comp.programming | Previous | NextNext in thread | Find similar


Thread

Re: Scanning Richard Heathfield <rjh@cpax.org.uk> - 2023-01-19 15:06 +0000
  Re: Scanning Noel Duffy <uaigh@icloud.com> - 2023-01-21 11:29 +1300

csiph-web