> Is this not just evidence of a very bad Python coding style?
> Should we not always declare *all* class fields in the class definition
> by assigning to them, even if the assignment is token or dummy
> i.e. 'None', "", [], {} etc.
this is one of the many things that pylint can warn you about.
I
Alan asked me:
> As to access to the internal data would it be difficult to
> parameterise it so that each companies data is in a
> local config file? That way even if the dissasemble
> the code it won't help?
Unfortunately no. The input files are human readable geometrical
models. Each tool ha
I asked:
> Is it possible to convert a Python package, with __init__.py and
> related python modules, into a single DLL or shared library that can
> be imported in the same way?
>
> We have used py2exe and cx_freeze to create a complete executable,
> but we are curious whether there is a middle wa
Is it possible to convert a Python package, with __init__.py and
related python modules, into a single DLL or shared library that can
be imported in the same way?
We have used py2exe and cx_freeze to create a complete executable,
but we are curious whether there is a middle way between this singl
> I have a text file (mylist.py actually), it contains exactly below:
> ---
> # file mylist.py
> jobs = [
> 'Lions',
> 'SysTest',
> 'trainDD',
> 'Cats',
> 'train',
> 'sharks',
> 'whale',
> ]
>
>
> I want
> I've been searching for a module to allow simple HTML generation, but
> most of them appear to be more concerned with *parsing* HTML and XML.
> The only one that looks promising from reviews dating back to 1998 or
> so is HTMLgen, but the link on starship.python.net appears long dead.
>
> So my
I'm updating an application at the moment that generates simple HTML
files. However, it's all done using plain strings and brute force.
It's hard to read, and isn't very robust in the face of special
characters and matching start and end tags.
I've been searching for a module to allow simple HTML
> I wondered if it was possible to do something like this:
>
> src/
>-a_module/
>-sub_module/
> test/
>-a_module/
>-sub_module/
Why not really keep the test code with the main code?
# module code here
#
if __name__ == '__main__':
import unittest
class TestModul
Duncan Gibson wrote:
> >
> > import csv
> >
> > class MyReader(object):
> >
> > def __init__(self, inputFile):
> > self.reader = csv.reader(inputFile, delimiter=' ')
> >
Kent Johnson wrote:
> The line_num attribute is new in Python 2.5. This is a doc bug,
> it should be noted in the description of line_num.
Is there some way to create a wrapper around a 2.4 csv.reader to
give me pseudo line number handling? I've been experimenting with:
import csv
clas
On Fri, 27 Oct 2006 11:35:40 +0200
Duncan Gibson <[EMAIL PROTECTED]> wrote:
>
> If I have the following data file, data.csv:
> 1 2 3
> 2 3 4 5
>
> then I can read it in Python 2.4 on linux using:
>
> import csv
> f = file('data.csv', &
If I have the following data file, data.csv:
1 2 3
2 3 4 5
then I can read it in Python 2.4 on linux using:
import csv
f = file('data.csv', 'rb')
reader = csv.reader(f)
for data in reader:
print data
OK, that's all well and good, but I would like to record
the li
One part of the application I'm dealing with handles a conceptual
'cube' of data, but is in fact implemented as a single python
list. Items are stored and retrieved - no manipulation at the
moment - by the classical approach of multiplying the appropriate
x, y and z indices with the x, y and z ex
I wrote:
> >def newOutput(x):
> >if x is None:
> >pass
> >return
> >try:
> >x.output()
> >except AttributeError:
> >if isinstance(x, int):
> >pass
> >elif isinstance(x, float):
> >
I've taken over someone else's code (yes, honestly!) that has a
complex class hierarchy on top of the main procedural code. This
is unfortunate because it means that isinstance() is everywhere.
Profiling recently highlighted one particular formatted output
function that has a cascade of isinstan
This is off-topic for Python: I've seen this on the FLTK mailing list,
but you might find some of the links under this page useful:
http://myweb.tiscali.co.uk/oaktree/nshea/tesselsphere/tesselsphere_index.html
"OpenGL spherical subdivision utility. Currently employs particle
and geodesic mod
I wrote:
> > class MyFile(file):
> > etc
> >
> > I couldn't see how to have an instance of MyFile returned from the
> > built-in 'open' function. I thought this was the crux of the problem.
Kent Johnson replied:
> open() is actually just an alias for file():
> >>> open is file
> Tru
Kent Johnson wrote:
> If you just want to keep track of line numbers as you read the file by lines,
> you could use enumerate():
>
> f = open('myfile.txt')
> for line_number, line in enumerate(f):
> ...
This is neat, but not all of the parsers work on a 'line by line' basis,
so sometimes there
I was sure that this must be a frequently asked [homework?] question,
but trying to search for 'file open line number' didn't throw up the
sort of answers I was looking for, so here goes...
I regularly write parsers for simple input files, and I need to give
helpful error messages if the input is
We've been programming in Python for about a year. Initially we had a
lot of tests of the form
if x == None:
do_something()
but then someone thought that we should really change these to
if x is None:
do_something()
However. if you run pychecker on these two snippets of
20 matches
Mail list logo