Re: low-level csv

2019-11-17 Thread Dave Cinege
The few times I looked at CSV module it never looked useful to me. I seem to use shlex for everything. For example: def csv_split (s): lex = shlex.shlex(s, posix=True) lex.whitespace_split = True lex.whitespace = ',' return list(lex) will split on commas while ho

Re: How to delay until a next increment of time occurs ?

2019-11-14 Thread Dave Cinege
Rudy, OK I'm old enough cancer to know what X10 is. :-) I wouldn't think this is too difficult to do as you're only sending. For this application IMO there is too much going on inside python that can interrupt the cycle of modulation. (Intra and Extra python; garbage collection, other process

Re: How to delay until a next increment of time occurs ?

2019-11-14 Thread Dave Cinege
Can you expand on what you are trying to accomplish with this? It seems a small C program or library you interface python too is a better solution. With that said, as others mentioned you might need a real time OS or micro controller if this needs to be dead on timing. Dave On 2019/11/13 09:0

ANNOUNCE: Thesaurus and ThesaurusCfg - recursive mapping and cfg file data types

2019-11-13 Thread Dave Cinege
This announcement is for a pre-release that I would like people to comment on structure, naming, etc. (Code review maybe not yet. :-) Before you say "It's all been done before." I suggest you take a closer look and I think you may conclude that what I've revised over 7 years is now interesting

ANNOUNCE: Thesaurus - a recursive dictionary subclass using attributes

2013-01-08 Thread Dave Cinege
ng to generate output or command lines for external programs, or wish you had a dictionary that could act (sort of) like a class, Thesaurus may be for you. #!/usr/bin/env python """ thesaurus.py 2012-09-13 Copyright (c) 2012 Dave Cinege Licence: python, Copyright notice may not be al

Re: ANNOUNCE: Thesaurus - a recursive dictionary subclass using attributes

2012-12-12 Thread Dave Cinege
On Monday 10 December 2012 23:08:24 Jason Friedman wrote: > 2) Posting your code at ActiveState.com. If someone wants to please do. I'm back to being completely overloaded with normal work now. The v20121212 release based on the last few days comments is as far as I will go with this now. Dave

ANNOUNCE: Thesaurus - a recursive dictionary subclass using attributes - v20121212

2012-12-12 Thread Dave Cinege
Version 20121212 #!/usr/bin/env python """ thesaurus.py 2012-12-12 Copyright (c) 2012 Dave Cinege Licence: PSF Licence, Copyright notice may not be altered. Thesaurus: A different way to call a dictionary. Thesaurus is a new a dictionary subclass which allows calling keys as if

Re: ANNOUNCE: Thesaurus - a recursive dictionary subclass using attributes

2012-12-12 Thread Dave Cinege
On Wednesday 12 December 2012 20:14:08 Chris Angelico wrote: Ok enough already, I'll use the frigging thing! Be happy I'm at least still not coding for python 1.5. > To add to this: Using enumerate gives the possibility (don't know if > any current interpreter takes advantage or not, but a futur

Re: ANNOUNCE: Thesaurus - a recursive dictionary subclass using attributes

2012-12-12 Thread Dave Cinege
On Wednesday 12 December 2012 15:42:36 Ian Kelly wrote: > def __getattribute__(self, name): > if name.startswith('__') and name.endswith('__'): > return super(Thesaurus, self).__getattribute__(name) > return self.__getitem__(name) Ian, Tested, and works as you advertised. Isn't

Re: ANNOUNCE: Thesaurus - a recursive dictionary subclass using attributes

2012-12-12 Thread Dave Cinege
On Tuesday 11 December 2012 01:41:38 Ian Kelly wrote: > I have a few critiques on the code. First, you might want to use > __getattribute__ instead of __getattr__. Otherwise you'll end up File "/home/dcinege/src/thesaurus/thesaurus.py", line 84, in __getattribute__ return self.__getitem_

Re: ANNOUNCE: Thesaurus - a recursive dictionary subclass using attributes

2012-12-12 Thread Dave Cinege
On Wednesday 12 December 2012 05:25:11 D'Arcy J.M. Cain wrote: As a 16yr OSS vet I know that for every 1 person that that actually creates something there will always be 2000 people to bitch about it. My skin isn't thin, I just don't give a shit to listen to anyone one that doesn't get it. The

Re: ANNOUNCE: Thesaurus - a recursive dictionary subclass using attributes

2012-12-11 Thread Dave Cinege
On Tuesday 11 December 2012 17:39:12 Dave Cinege wrote: My memory is getting jogged more why did some things: raise KeyError(key + ' [%s]' % i) I did this to specificly give you the indice that failed recursion but provide the entire key name as it was provided to __getite

Re: ANNOUNCE: Thesaurus - a recursive dictionary subclass using attributes

2012-12-11 Thread Dave Cinege
On Tuesday 11 December 2012 16:53:12 Ian Kelly wrote: > Just out of curiosity, how old are we talking? enumerate was added in > Python 2.3, which is nearly 10 years old. Prior to 2.2 I don't think > it was even possible to subclass dict, which would make your Thesaurus > implementation unusable,

Re: ANNOUNCE: Thesaurus - a recursive dictionary subclass using attributes

2012-12-11 Thread Dave Cinege
On Tuesday 11 December 2012 03:12:19 Steven D'Aprano wrote: > Is this intended as a ready-for-production class? For me, yes. In production code. > py> d = Thesaurus() > py> d['spam'] = {} Maybe because spam is type dict instead of type thes??? >>> import thesaurus >>> thes = thesaurus.Thesauru

Re: ANNOUNCE: Thesaurus - a recursive dictionary subclass using attributes

2012-12-11 Thread Dave Cinege
On Tuesday 11 December 2012 01:41:38 Ian Kelly wrote: > running into bugs like this: > >>> thes = Thesaurus() > >>> thes.update = 'now' > >>> thes.update > > I've noticed this but it's mostly pointless, as meaningful code does work. (Also you stepped on the existing 'update()' dictionary method

ANNOUNCE: Thesaurus - a recursive dictionary subclass using attributes

2012-12-10 Thread Dave Cinege
ng to generate output or command lines for external programs, or wish you had a dictionary that could act (sort of) like a class, Thesaurus may be for you. #!/usr/bin/env python """ thesaurus.py 2012-09-13 Copyright (c) 2012 Dave Cinege Licence: python, Copyright notice may not be al