Clash of the Titans
>From "Dive into Python":
__init__ is called immediately after an instance of the class is
created. It would be tempting but incorrect to call this the
constructor of the class. It's tempting, because it looks like a
constructor (by convention, __init__ is the first method def
Jacob S. wrote:
sorry to send this to you but if you may, kindly send to tutor list as im
no longer subscribed. my problem is in the update dict portion: it just
doesnt update regardless how many contacts i add. kindly advise where
my mistake is or code gone wrong. the rest of the options i will d
> >>> import decimal
> >>> decimal.getcontext().prec = 2
> >>> a = decimal.Decimal(2)
> >>> b = decimal.Decimal(3)
> >>> 100*a/b
> Decimal("67")
> >>> print 100*a/b
This prints "67".
> try -
>
> a=decimal.Decimal(2.0)
This will not work. You can't convert a float directly to a decimal.Decimal
Jacob S. wrote:
Hi all,
I'm having a problem that is ticking me off. (to put it lightly)
Why does decimal do this -- I thought that getcontext().prec was
number of decimal places?
import decimal
decimal.getcontext().prec = 2
a = decimal.Decimal
Jacob- one slight flaw/quirk in Python is if you want floating point
computations you have to specify a floating point.
>>> import decimal
>>> decimal.getcontext().prec = 2
>>> a = decimal.Decimal(2)
>>> b = decimal.Decimal(3)
>>> 100*a/b
Decimal("67")
>>> print 100*a/b
try -
a=decimal.Decimal
update_dict(data_holder, filename)
>else: # file no exist
>write_book(data_holder, filename)
>break
>else:
>d.clear() #clear dict
>break
There's two elses, but no inital if:
There's a plac
[Jacob S.]
>I'm having a problem that is ticking me off. (to put it lightly)
> Why does decimal do this -- I thought that getcontext().prec
> was number of decimal places?
It's unclear what you mean by "decimal places". From context, you
_appear_ to mean "number of decimal digits after the r
Hi all,
I'm having a problem that is ticking me off. (to put it lightly)
Why does decimal do this -- I thought that getcontext().prec was number of
decimal places?
import decimal
decimal.getcontext().prec = 2
a = decimal.Decimal(2)
b = decimal.Decimal(3)
100*a/b
Decimal("67")
print 100*a/b
67
Hi everyone, sent this on to the list as told to.
cc to eri to verify my sending to list...
;-) Jacob
dear jacob,
sorry to send this to you but if you may, kindly send to tutor list as im
no longer subscribed. my problem is in the update dict portion: it just
doesnt update regardless how many cont
Kent Johnson wrote:
On Jan 19, 2005, at 03:58, David Rock wrote:
Indeed. The problem is, even if I know what I'm looking for, the
problem remains that given the following document,
baz
If I want to get "baz", the command is ...
I'll try to find the time to write up a full example
On Wed, 19 Jan 2005, Danny Yoo wrote:
> On Wed, 19 Jan 2005, Marilyn Davis wrote:
>
> > class Exim:
> > def __init__(self):
> > self.fdin = None
> > self.err_flush = []
> > self.stdout, self.stdin, self.stderr = popen2.popen3('%s -t' %
> > MAILER)
> > se
At a certain time, now past [Jan.17.2005-01:48:34PM -0500],
elh@outreachnetworks.com spake thusly:
> The following block of code works, and provides the necessary output I'm
> looking for...but I have a feeling that it's working through sheer brute
> force and could be better:
>
> insideipgre
On Wed, 19 Jan 2005, Marilyn Davis wrote:
> class Exim:
> def __init__(self):
> self.fdin = None
> self.err_flush = []
> self.stdout, self.stdin, self.stderr = popen2.popen3('%s -t' %
> MAILER)
> self.fdin = self.stdin.fileno()
> self.fdout = s
Thank you Kent.
On Wed, 19 Jan 2005, Kent Johnson wrote:
> Marilyn Davis wrote:
> >>few lines up, right where 'client_socket' is initialized. Like this:
> >>
> >>###
> >>try:
> >>client_socket, client_addr = self.server_socket.accept()
> >>Spawn(client
>
> > What about when I do an explicit call to a close inside a __del__. Is
> > that a bad idea?
>
> I usually prefer to add a close() method to my objects that releases
> resources, rather than __del__(), because it's more visible.
>
OK Danny! I found it! When I was almost asleep last night
That is too easy. I was looking at the examples of how to replace the old
popen and I just did not get it but the page you sent is great.
John
-Original Message-
From: Danny Yoo [mailto:[EMAIL PROTECTED]
Sent: Wednesday, January 19, 2005 10:34
To: Ertl, John
Cc: tutor@python.org
Subje
On Wed, 19 Jan 2005, Ertl, John wrote:
> I am using the subprocess.Popen from 2.4. I can launch a job from
> python and the output from the job goes to the screen but now I would
> like to have the output go to a file. I could do the crude
>
> subprocess.Popen("dtg | cat > job.out", shell=True
I am using the subprocess.Popen from 2.4. I can launch a job from python
and the output from the job goes to the screen but now I would like to have
the output go to a file. I could do the crude
subprocess.Popen("dtg | cat > job.out", shell=True)
But I would think there is a better way built i
David Rock wrote:
* Max Noel <[EMAIL PROTECTED]> [2005-01-19 11:48]:
On Jan 19, 2005, at 03:58, David Rock wrote:
For me, it seems that the way you are supposed to interact with an XML
DOM is to already know what you are looking for, and in theory, you
_should_ know ;-)
Indeed. The problem is, ev
* Max Noel <[EMAIL PROTECTED]> [2005-01-19 11:48]:
>
> On Jan 19, 2005, at 03:58, David Rock wrote:
>
> >For me, it seems that the way you are supposed to interact with an XML
> >DOM is to already know what you are looking for, and in theory, you
> >_should_ know ;-)
>
> Indeed. The proble
On 19 Jan 2005, [EMAIL PROTECTED] wrote:
> I have two lists:
>
> 1. Lseq:
>
len(Lseq)
> 30673
Lseq[20:25]
> ['NM_025164', 'NM_025164', 'NM_012384', 'NM_006380',
> 'NM_007032','NM_014332']
>
>
> 2. refseq:
len(refseq)
> 1080945
refseq[0:25]
> ['>gi|10047089|ref|NM_014332.1| Homo
I have a threaded python ( Python 2.3.4 ) script that runs perfectly on
Windows 2000 Server SP4 when it is executed from IDLE ( i.e. press 'F5' from
the editor ), the threads do their work, halt, and the 'join' command picks
them up. When I run the same script from windows command line ( cmd.exe ),
Hi all,
I want to make an IRC bot with python...
The problem is that I cant find any good information about this topic
(not even documentation for the irclib module).
Does anyone here have some experience with python programming for IRC
(clients, bots, etc) and can give me some simple source code
Kumar,
You should look for a way to solve this with dictionaries or sets. If you look for each element of
Lseq in each element of refseq, that is 33,155,825,985 lookups. That is a lot!
Sets have a fast test for membership, look for ways to use them!
In this case, the target string in refseq seems
On Jan 19, 2005, at 03:58, David Rock wrote:
For me, it seems that the way you are supposed to interact with an XML
DOM is to already know what you are looking for, and in theory, you
_should_ know ;-)
Indeed. The problem is, even if I know what I'm looking for, the
problem remains that given th
Marilyn Davis wrote:
few lines up, right where 'client_socket' is initialized. Like this:
###
try:
client_socket, client_addr = self.server_socket.accept()
Spawn(client_socket).start()
except socket.error, msg:
time.sleep(.5)
Hi kumar
If I unterstood your question correctly, you have to iterate over the refseq
until
you get the next entry, which starts with a '>'
on Tue, 18 Jan 2005 20:12:32 -0800 (PST) kumar s <[EMAIL PROTECTED]> wrote :
-
On Wed, 19 Jan 2005, Max Noel wrote:
> I've just spent the last few hours learning how to use the DOM XML
> API (to be more precise, the one that's in PyXML), instead of revising
> for my exams :p. My conclusion so far: it sucks (and so does SAX because
> I can't see a way to use it for OO
28 matches
Mail list logo