I do some linear algebra and whenever the prefactor of a vector turns
out to be zero, I want to remove it.
I'd like to keep the system comfortable. So basically I should write a
new class for numbers that has it's own __eq__ operator?
Is there an existing module for that?
--
http://mail.python.o
>> NS/dir1/file1.py
>> NS/dir2/file2.py
> This *must* be wrong or at least not the full directory listing - please
> read
It is the directory structure in one of the python paths.
> Missing __init__.py in the dir2?
Oh right. I forgot about this. Thank you!
--
http://mail.python.org/mailman/listinf
I have a directory structure like
NS/dir1/file1.py
NS/dir2/file2.py
if in the python shell I type
import NS.dir1.file1
it works, however typing
import NS.dir2.file2
fails with
ImportError: No module named dir2.file2
Any ideas what could go wrong?
Directory permissions seem to be OK.
--
htt
> If you have the
>
> from __future__ import division
>
> statement, you need to override __truediv__(), not __div__()
That worked after I also added
from __future__ import division
to all other modules I created.
Is it possible that there appears an inconsistency if the division is
imported in
Hello!
I wrote a class
class NumX:
...
def __add__(self,other):
...
def __div__(self,other):
if not isinstance(other,NumX): other=NumX(other)
...
Somewhere else I use
a=(b+c)/2
where all variables are of NumX Type. When I execute the program it
complains that it can't find an
Hi!
it seems that
class Obj:
def __init__(self):
f=file("obj.dat")
self=pickle.load(f)
...
doesn't work. Can an object load itself with pickle from a file somehow?
What's an easy solution?
Anton
--
http://mail.python.org/mailman/listinfo/python-list
> If you insist on building the codes yourself instead of using the
> standard curses library...
>
> print '\x1b[34m%8s\x1b[0m' % 'TEST'
Will the curses library help? The problem is I need the colour coded in my
string and the "print pattern" is static.
What's the quickest way to solve this with
For example:
print '%8s' % '\x1b[34mTEST\x1b[0m'
doesn't not indent 'TEST' whereas
print '%8s' % TEST'
works.
--
http://mail.python.org/mailman/listinfo/python-list
Hi all!
I used escape sequences to produce colour output, but a construct like
print "%8s" % str_with_escape
doesn't do the right thing. I suppose the padding counts the escape
characters, too.
What could be a solution?
Anton
--
http://mail.python.org/mailman/listinfo/python-list
> Hi Anton,
>
> here is a little snippet using os.popen:
Unfortunately I'm having more problem getting the output from Gnuplot, which
I'd like to examine for error messages and settings of options.
Anton
--
http://mail.python.org/mailman/listinfo/python-list
Hi,
it seems to be a FAQ, but I still haven't found a solution. I want to
control gnuplot with a python program. The following at least gives me the
gnuplot output:
subp=Popen("gnuplot",stdin=None,stderr=PIPE,stdout=PIPE)
...
subp.stderr.readline()
even though I'm not sure how to check if no mor
Hi,
I want to use globals that are immediately visible in all modules. My
attempts to use "global" haven't worked. Suggestions?
Anton
--
http://mail.python.org/mailman/listinfo/python-list
Hi,
I've written a python script and added short docstrings. Now I'd like to
create a short overview of commands the user can use. However I don't want
the internal stuff that I also commented. Is there a way to create a fancy
documentation (e.g. pydoc) of certain functions only?
Anton
--
http:/
Hi!
When I do simple calculation with float values, they are rarely exactly
equal even if they should be. What is the threshold and how can I change
it?
e.g. "if f1==f2:" will always mean "if abs(f1-f2)<1e-6:"
Anton
--
http://mail.python.org/mailman/listinfo/python-list
14 matches
Mail list logo