for a little cherrypy app I'm working on I wrote the piece of code
below. Goal is to obscure the first part of a directory path(s) the
user is browsing. Replacing the first part of the path with an alias
works fine, but for the application it has to work both ways. I know
how to swap the keys and v
On Nov 28, 2007 8:16 PM, Kent Johnson <[EMAIL PROTECTED]> wrote:
> ingo janssen wrote:
> > Is there a dict that works "both ways"?
>
> another implementation here:
> http://www.radlogic.com/releases/two_way_dict.py
>
Perfect, never thought to actually search f
For parsing the out put of the Voro++ program and writing the data to a
POV-Ray include file I created a bunch of functions.
def pop_left_slice(inputlist, length):
outputlist = inputlist[0:length]
del inputlist[:length]
return outputlist
this is used by every function to chop of the requi
On 06/02/2019 19:07, Mark Lawrence wrote:
That's going to a lot of work slicing and dicing the input lists.
Perhaps a chunked recipe like this
https://more-itertools.readthedocs.io/en/stable/api.html#more_itertools.chunked
would be better.
The length of the text chunks varies from a single
On 06/02/2019 21:45, Mark Lawrence wrote:
So what, you still don't need to chop the front from the list, just
process the data.
just slice
I'd like to adapt the order in that the functions are applied, but how?
I suspect that you're trying to over complicate things, what's wrong
with
On 07/02/2019 09:29, Peter Otten wrote:
Where will you get the order from?
Peter,
the order comes from the command line. I intend to call the python
program with the same command line options as the Voro++ program. Make
the python program call the Voro++ and process its output.
one comma
On 07/02/2019 09:58, ingo janssen wrote:
On 07/02/2019 09:29, Peter Otten wrote:
Where will you get the order from?
Ahrg, that should have been:
#all output formatting options
order = "%i %q %r %w %p %P %o %m %g %E %s %e %F %a %A %f %t %l %n %v %c %C"
order = re.findall(&quo
On 07/02/2019 10:40, Alan Gauld via Tutor wrote:
Just saves a little typing is all.
Sensei,
be lazy, I will study
current state of code is at
https://gist.github.com/ingoogni/e99c561f23777e59a5aa6b4ef5fe37c8
ingo
___
Tutor maillist - Tutor@py
On 07/02/2019 11:08, Peter Otten wrote:
Personally I would avoid the NameError and start with empty lists. If you
manage to wrap all branches into functions with the same signature you can
replace the sequence of tests with dictionary lookups.
Just before I saw your post I put my current cod
On 07/02/2019 11:08, Peter Otten wrote:
replace the sequence of tests with dictionary lookups
updated the gist a few times, now I could pre calculate the slices to be
taken per line, but will there be much gain compared to the copping from
the left side of the list?
ingo
On 07/02/2019 18:06, Peter Otten wrote:
Sorry, I don't understand the question.
after a quick look not unlike what you propose but I have to investigate
further,
lengths of chunks are known or can be found (sketchy):
order= [%i,%q,%r,%w,%p,%P,%o,%m,%g,%E,%s,%e,%F,%a,%A,%f,%t,%l,%n,%v,%c,%
One thing I often struggle with is how to deal with exceptions,
especially when I have a chain of functions that use each others output
and/or long running processes. As the answer will probably be "it
depends" take for example this program flow:
open a file and read into BytesIO buffer
get a
On 24/03/2019 00:03, Cameron Simpson wrote:
Short takeaway: decide what's mechanism and what is policy, and try to
put policy further out in higher level code.
That, Cameron, was a very insightful answer and an eye opener, as I try
to 'fix things' as early as possible. It also answered the que
13 matches
Mail list logo