Thanks for the ideas,
I see I still don't have the hang of this context thing! I still haven't
provided enough
context. So here goes again, to show the entire chain. This might change the
discussion to be about design practice but it will give overview of how I'm
using
the class in question.
Firs
Eric Pavey wrote:
Presume I have a package 'a' like this:
* /pystuff (added to sys.path)
o /a (start of my package)
+ __init__.py
+ /b
# __init__.py
# module.py
to import module.py:
import *a.b.module
Presume I have a package 'a' like this:
- /pystuff (added to sys.path)
- /a (start of my package)
- __init__.py
- /b
- __init__.py
- module.py
to import module.py:
import *a.b.module*
What I'm trying to find is a way to query exactly what I typed ab
"Stefan Behnel" wrote
Note that ElementTree provides both a SAX-like interface (look for the
'target' property of parsers) and an incremental parser (iterparse).
Interesting, I didn't realise that.
I've only ever used it to build a tree.
XML parsers fall into 2 groups. Those that parse the
Luke Paireepinart wrote:
On Tue, Nov 10, 2009 at 1:21 PM, Dave Angel wrote:
(Removing out of sequence history)
DaveA
instances of that class. Better than using tuples.
makes sense to make a class to hold the seven parameters, and pass two
If you're passing two sets of 7 parameters to the
On Tue, Nov 10, 2009 at 1:21 PM, Dave Angel wrote:
> (Removing out of sequence history)
>
> DaveA
>
> instances of that class. Better than using tuples.
> makes sense to make a class to hold the seven parameters, and pass two
> If you're passing two sets of 7 parameters to the same function, it
"C.T. Matsumoto" wrote
This list provides defines 2 tables that need to be paired and then
compared.
So two instances of a TestTable object maybe?
reference_table_name
reference_dburi
reference_rows
test_table_name
test_dburi
test_rows
keys
Looks like two TestTable objects and a set of
Stephen Nelson-Smith wrote:
NameError: global name 'date' is not defined
How does __iter__ know about date? Should that be self.date?
S.
Yes.
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.p
(Removing out of sequence history)
DaveA
instances of that class. Better than using tuples.
makes sense to make a class to hold the seven parameters, and pass two
If you're passing two sets of 7 parameters to the same function, it probably
___
Tuto
On Tue, Nov 10, 2009 at 11:25 AM, Stephen Nelson-Smith
wrote:
> So what I want to do is be able to multiplex the files - ie read the
> next line of all 12 files at once, filter them accordingly, and then
> write them out to one combined file.
>
> My old code did this;
>
> min((x.stamp, x) for x i
On Tue, Nov 10, 2009 at 3:59 PM, Stephen Nelson-Smith
wrote:
> On Tue, Nov 10, 2009 at 3:48 PM, Stephen Nelson-Smith
> wrote:
>
>> OK, so now i've given it the full load of logs:
>>
> for time, entry in kent.logs:
>> ... print time, entry
>> ...
>> Traceback (most recent call last):
>> Fil
On Tue, Nov 10, 2009 at 3:48 PM, Stephen Nelson-Smith
wrote:
> OK, so now i've given it the full load of logs:
>
for time, entry in kent.logs:
> ... print time, entry
> ...
> Traceback (most recent call last):
> File "", line 1, in ?
> ValueError: too many values to unpack
>
> How do I ge
Hello,
On Tue, Nov 10, 2009 at 2:00 PM, Luke Paireepinart
wrote:
>
>> Traceback (most recent call last):
>> File "", line 1, in ?
>> File "kent.py", line 11, in __iter__
>> if stamp.startswith(date):
>> NameError: global name 'date' is not defined
>>
>> How does __iter__ know about date? Sh
C.T. Matsumoto wrote:
Hello All,
I'm making a class and the parameters I'm feeding the class is getting
quite large. I'm up
to 8 now. Is there any rules of thumb for classes with a lot of
parameters? I was thinking
to put the parameters into a tuple and then in the __init__ of the
class, iter
> Traceback (most recent call last):
> File "", line 1, in ?
> File "kent.py", line 11, in __iter__
>if stamp.startswith(date):
> NameError: global name 'date' is not defined
>
> How does __iter__ know about date? Should that be self.date?
>
Yes. self.date is set in the constructor.
_
Hi,
> probably that line should have been " ".join(line.split()[3:5]), i.e.
> no self. The line variable is a supplied argument.
Now I get:
Python 2.4.3 (#1, Jan 21 2009, 01:11:33)
[GCC 4.1.2 20071124 (Red Hat 4.1.2-42)] on linux2
Type "help", "copyright", "credits" or "license" for more inform
On Tue, Nov 10, 2009 at 2:25 PM, Stephen Nelson-Smith
wrote:
>
>
>From here I get:
>
> import gzip
>
> class LogFile:
>def __init__(self, filename, date):
>self.logfile = gzip.open(filename, 'r')
>self.date = date
>
>def __iter__(self):
>for logline in self.logfile:
Hi Kent,
> One error is that the initial line will be the same as the first
> response from getline(). So you should call getline() before trying to
> access a line. Also you may need to filter all lines - what if there
> is jitter at midnight, or the log rolls over before the end.
Well ultimatel
On Tue, Nov 10, 2009 at 5:04 AM, Stephen Nelson-Smith
wrote:
> I have the following idea for multiplexing logfiles (ultimately into heapq):
>
> import gzip
>
> class LogFile:
> def __init__(self, filename, date):
> self.logfile = gzip.open(filename, 'r')
> for logline in self.logf
This reply is also to Alan's suggestion to provide more context.
The situation concerns databases, where in one schema table I've got a
'compare list'.
This list provides defines 2 tables that need to be paired and then
compared. Before
any comparing happens I 'filter' the compare list doing sever
Alan Gauld, 10.11.2009 06:53:
> "Christopher Spears" wrote
>> I need to parse several XML documents into a Python dictionary. Is
>> there a module that would be particularly good for this? I heard
>> beginners should start with ElementTree. However, SAX seems to make a
>> little more sense to m
I have the following idea for multiplexing logfiles (ultimately into heapq):
import gzip
class LogFile:
def __init__(self, filename, date):
self.logfile = gzip.open(filename, 'r')
for logline in self.logfile:
self.line = logline
self.stamp = self.timest
22 matches
Mail list logo