scott [EMAIL PROTECTED] wrote:
hi people,
can someone tell me, how to use a class like that* (or simulate more
than 1 constructor) :
#--
class myPointClass:
def __init__(self, x=0, y=0):
self.x = x
self.y = y
def __init__(self, x=0, y=0, z=0):
self.__init__(self, x, y)
After taking a break from following PEP 343 and it's associated PEPs, I
wanted to look at it again because it still seemed a bit hard to get my
mind around.
http://www.python.org/peps/pep-0343.html
A new statement is proposed with the syntax:
with EXPR as VAR:
Well one way to do this (not sure if it is the best way) is something like.
class mypoint:
def __init__(self, *args):
len_args = len(args)
print len_args
if len_args == 0:
self.x = 0
self.y = 0
self.z = 0
elif len_args =2 and len_args = 3:
F. Petitjean wrote:
As you whish :-)
Damn freedom of choice *g
if in the package ie in the __init__.py (not the best idea) from PDF
import File as PDFFile # always possible
Technically, this is clear - however I don't like the idea of giving the
same thing different names, especially if
At 3:14 PM +0100 6/22/05, Will McGugan wrote:
Hi,
I'd like to write a windows app that accesses a locally stored database.
There are a number of tables, the largest of which has 455,905 records.
Can anyone recommend a database that runs on Windows, is fast /
efficient and can be shipped without
Take a look at this snippet:
class L(list):
... def __init__(self, v):
... super(L, self).__init__(v)
... def __setitem__(self, key, value):
... print key.indices(len(self))
...
v = L(range(10))
v
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
v[::] = [1]
(0, 10, 1)
v[0:10:1] = [1]
(0, 10, 1)
Hello Python list
If a Python program has an import statement like:
import FFT
how do I determine the path to the imported file?
Thanks,
Daniel
--
http://mail.python.org/mailman/listinfo/python-list
In article [EMAIL PROTECTED], Dan [EMAIL PROTECTED] wrote:
On 6/22/2005 1:14 PM, Dave Cook wrote:
On 2005-06-22, Cameron Laird [EMAIL PROTECTED] wrote:
Are you saying that Python-based applications are particularly
vulnerable in this all-too-common scenario? If so, I'm not
getting it; why
Skip Montanaro wrote:
Terry Yeah, and I find this even more so:
Terry case = {
Terry 5: do_this,
Terry 6: do_that,
Terry }
Terry case.get(x, do_default)()
Terry Which is looking pretty close to a case statement, anyway.
Sure, modulo
Dave Opstad wrote:
So given the equality of their slice representations, why do the v2[::]
and v2[0:10:1] assignments behave differently? My reading of section
5.3.3 of the manual suggests that these should behave the same.
If I'm just not seeing something obvious, please let me know!
This is not really Python specific, but I know Python programmers are
among the best in the world. I have a fair understanding of the
concepts involved, enough to realize that I would benefit from the
experience of others :)
I have a shared series of objects in memory that may be 100MB. Often
to
but the gcc was installed on this system tho:
gcc -v
Reading specs from
/export/home/local/bin/../lib/gcc/sparc-sun-solaris2.8/3.4.2/specs
Configured with: ../configure --with-as=/usr/ccs/bin/as
--with-ld=/usr/ccs/bin/ld --disable-nls
Thread model: posix
gcc version 3.4.2
--
In article [EMAIL PROTECTED],
Diez B. Roggisch [EMAIL PROTECTED] wrote:
So - the rationale seems to be: When using slice-assignment, a form
like l[a:b:c] imposes possibly a non-continous section in l, for which
the semantics are unclear - so we forbid it
But it isn't forbidden:
v =
Eloff [EMAIL PROTECTED] writes:
I have a shared series of objects in memory that may be 100MB. Often
to perform a task for a client several of these objects must be used.
Do you mean a few records of 20+ MB each, or millions of records of a
few dozen bytes, or what?
However imagine what
Dave Opstad wrote:
In article [EMAIL PROTECTED],
Diez B. Roggisch [EMAIL PROTECTED] wrote:
So - the rationale seems to be: When using slice-assignment, a form
like l[a:b:c] imposes possibly a non-continous section in l, for which
the semantics are unclear - so we forbid it
But it
Thanks for the replies. I think I'm going to go with sqllite for now.
For the curious, Im writing an interface to a nutritional database. So
you can type in a foodstuff and it will tell you whats in it..
Will McGugan
--
http://www.willmcgugan.com
.join({'*':'@','^':'.'}.get(c,0) or
Hello,
I am building a object cache in python, The cache has a maximum size and the
items have expiration dates.
At the moment I'm doing like that:
cache = {} # create dictionary
cache[ID] = (object, timestamp) # Save a tuple with the object itself and a
timestamp (from datetime.datetime.now())
Hi Paul,
Do you mean a few records of 20+ MB each, or millions of records of a
few dozen bytes, or what?
Well they're objects with lists and dictionaries and data members and
other objects inside of them. Some are very large, maybe bigger than
20MB, while others are very numerous and small (a
I don't beleive that it does. You can however call ping() on the
connection which should attempt an automatic reconnection.
See the docs for mysql_ping:
http://dev.mysql.com/doc/mysql/en/mysql-ping.html
I've never tested that, but I have a need for it also so let me know if
it works or not.
Hi
Is there any detailed documentation on the structure of Pythons internals,
besides the source code itself?
More specifically I am looking for information regarding the C parser, since
I am looking into the viability of using it in another project that needs
to parse python code (and I would
On 6/22/05, Doug Ly [EMAIL PROTECTED] wrote:
Is there a good IDE for Python?
See http://tinyurl.com/8jqjc
- kv
--
http://mail.python.org/mailman/listinfo/python-list
SHELTRAW, DANIEL [EMAIL PROTECTED] writes:
Hello Python list
If a Python program has an import statement like:
import FFT
how do I determine the path to the imported file?
guru% python
Python 2.4.1 (#2, Apr 25 2005, 21:42:44)
[GCC 3.4.2 [FreeBSD] 20040728] on freebsd5
Type help,
Florian Lindner [EMAIL PROTECTED] writes:
What possible you see to optimize this lookup? Or anything else you see to
make it better?
Use the heapq module.
--
http://mail.python.org/mailman/listinfo/python-list
On Wednesday 22 June 2005 08:23 am, Peter Hansen wrote:
Jack Diederich wrote:
The '.info' domain also defeats
the linux 'whois' command to dig for registrar info.
Maybe so, but it's always pretty easy to Google for whois plus the
domain to find a way of doing it via the web, in this case
Paul Rubin wrote:
Ron Adam [EMAIL PROTECTED] writes:
A new statement is proposed with the syntax:
with EXPR as VAR:
BLOCK
Here, 'with' and 'as' are new keywords; EXPR is an arbitrary
expression (but not an expression-list)...
How is EXPR arbitrary? Doesn't it need
Michael Barkholt [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Is there any detailed documentation on the structure of Pythons
internals,
besides the source code itself?
In detail, in one place, no. There are bits and pieces in the C API docs
and the Lib man chapters on the
Mike Meyer wrote:
SHELTRAW, DANIEL [EMAIL PROTECTED] writes:
If a Python program has an import statement like:
import FFT
how do I determine the path to the imported file?
guru% python
Python 2.4.1 (#2, Apr 25 2005, 21:42:44)
[GCC 3.4.2 [FreeBSD] 20040728] on freebsd5
Type help,
Peter Hansen wrote:
Jack Diederich wrote:
The '.info' domain also defeats
the linux 'whois' command to dig for registrar info.
Maybe so, but it's always pretty easy to Google for whois plus the
domain to find a way of doing it via the web, in this case with
Grant Edwards [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
The bit patterns are defined by the IEEE 754 standard. If
there are Python-hosting platoforms that don't use IEEE 754 as
the floating point representation, then that can be dealt with.
Python has _tons_ of
On Wednesday 22 June 2005 01:42 pm, Thomas Lotze wrote:
Assume I have a package called PDF. Should the classes then be called
simply File and Objects, as it is clear what they do as they are
imported from PDF? Or should they be called PDFFile and PDFObjects, as
the names would be too
Mike Meyer wrote:
SHELTRAW, DANIEL [EMAIL PROTECTED] writes:
If a Python program has an import statement like:
import FFT
how do I determine the path to the imported file?
guru% python
Python 2.4.1 (#2, Apr 25 2005, 21:42:44)
[GCC 3.4.2 [FreeBSD] 20040728] on freebsd5
Type help,
i think this came up yesterday\
http://www.python.org/cgi-bin/moinmoin/IntegratedDevelopmentEnvironments
--
http://mail.python.org/mailman/listinfo/python-list
i think ring buffer
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/68429
--
http://mail.python.org/mailman/listinfo/python-list
Florian Lindner [EMAIL PROTECTED] writes:
What possible you see to optimize this lookup? Or anything else you see to
make it better?
Do you need to update the timestamp of cached entries when you access
them? If yes, use the heapq module. If no, is the cache something
different from a simple
Hello! I was wondering if anyone knows of any voicemail programs written in
python or any tools I could use to make one? My non-profit needs voicemail
and I wondered if there was anything that via a modem you could record
messages etc. Any help'll be appreciated!
SS
--
Grant Edwards wrote:
On 2005-06-22, Scott David Daniels [EMAIL PROTECTED] wrote:
Several issues:
(1) The number of distinct NaNs varies among platforms.
According to the IEEE standard, there are exactly two:
signalling and quiet, and on platforms that don't impliment
floating point
Scott David Daniels [EMAIL PROTECTED] writes:
Negative 0 isn't a NaN, it's just negative 0.
Right, but it is hard to construct in standard C.
Huh? It's just a hex constant.
--
http://mail.python.org/mailman/listinfo/python-list
I wrote PEP 304, Controlling Generation of Bytecode Files:
http://www.python.org/peps/pep-0304.html
quite awhile ago. The first version appeared in January 2003 in response to
questions from people about controlling/suppressing bytecode generation in
certain situations. It sat idle for a
Is anyone aware of freely available Python modules that can do any of
the following tasks:
1) Given the latitude/longitude of two locations, compute the distance
between them. Distance in this case would be either the straight-line
flying distance, or the actual over-ground distance that
a ring buffer?
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/68429
--
http://mail.python.org/mailman/listinfo/python-list
Eloff wrote:
Hi Paul,
If the 100 threads are blocked waiting for the lock, they shouldn't
get awakened until the lock is released. So this approach is
reasonable if you can minimize the lock time for each transaction.
Now that is interesting, because if 100 clients have to go through the
Paul Rubin wrote:
Scott David Daniels [EMAIL PROTECTED] writes:
Negative 0 isn't a NaN, it's just negative 0.
Right, but it is hard to construct in standard C.
Huh? It's just a hex constant.
Well, -0.0 doesn't work, and (double)0x8000 doesn't work,
and I think you have to use
Is this a python bug, or do i not understand
something?
http://www.linuxquestions.org/questions/showthread.php?s=threadid=336118
It seems to me that this should output each value
once, but i get some seemingly random duplicates.
If it is a bug, what do i file it under. I don't know
what's wrong
On 6/22/05, Peter Maas [EMAIL PROTECTED] wrote:
Isaac Rodriguez schrieb:
Does anyone know of a Python API to manipulate CAB files?
I guess you'll have to interface with setupapi.dll
(SetupIterateCabinet) via ctypes, or with Microsoft Cabinet utilities
via subprocess module. Neither is what
My program is running on windows and it is wrritten by Python and wxPython,
built by py2exe.
If my program is executed minimized, and the user want to shutdown or
reboot.
Meanwhile, my program is running and it has several threads running, too.
The shutdown or reboot will cause a error of my
Hi Steve,
The backup thread only holds the lock long enough to create an
in-memory representation of the data. It writes to disk on it's own
time after it has released the lock, so this is not an issue.
If you're saying what I think you are, then a single lock is actually
better for performance
On 6/23/05, Steve Horsley [EMAIL PROTECTED] wrote:
It is my understanding that Pythons multithreading is done at the
interpteter level and that the interpreter itself is single
threaded. In this case, you cannot have multiple threads running
truly concurrently even on a multi-CPU machine
[Skip Montanaro wrote]
I wrote PEP 304, Controlling Generation of Bytecode Files:
http://www.python.org/peps/pep-0304.html
...
So speak up folks, otherwise my recommendation is that it be put out of its
misery.
I've had use for it before, but have managed to work around the
Damjan wrote:
Indeed, when i do this, then it works
import sys
sys.path.append('package')
However, why is it that package isn't added automatically to the pad?
When you execute a python program the directory where the program is is
automatically added to sys.path. No other directory is
Your list targets contains some values twice.
targets=[97,101,139,41,37,31,29,89,23,19,8,13,131,19,73,97,19,139,79,67,61,17,113,127]
for t in set(targets):
... if targets.count(t) 1: print t
...
97
139
19
It looks like the duplicated items in the output contain one of the
duplicated
jim bardin wrote:
Is this a python bug, or do i not understand
something?
http://www.linuxquestions.org/questions/showthread.php?s=threadid=336118
It seems to me that this should output each value
once, but i get some seemingly random duplicates.
Your targets contains duplicates - and
wow. that's too obviouse!
i've been looking at everything, but i just assumed
the data in the example was ok.
thanks alot
jim
--- Jeff Epler [EMAIL PROTECTED] wrote:
Your list targets contains some values twice.
[with the start of US summer comes the start of 754 ranting season]
[Grant Edwards]
Negative 0 isn't a NaN, it's just negative 0.
[Scott David Daniels]
Right, but it is hard to construct in standard C.
[Paul Rubin]
Huh? It's just a hex constant.
[Scott David Daniels]
Well, -0.0 doesn't
Scott David Daniels [EMAIL PROTECTED] writes:
Negative 0 isn't a NaN, it's just negative 0.
Right, but it is hard to construct in standard C.
Huh? It's just a hex constant.
Well, -0.0 doesn't work, and (double)0x8000 doesn't work,
and I think you have to use quirks of a compiler
On 22 Jun 2005 14:09:42 -0700,
Eloff [EMAIL PROTECTED] wrote:
[Paul Rubin]
You're doing what every serious database implementation needs to do ...
Are you sure you don't want to just use an RDBMS?
It was considered, but we decided that abstracting the data into
tables to be manipulated with
Eloff [EMAIL PROTECTED] writes:
If the 100 threads are blocked waiting for the lock, they shouldn't
get awakened until the lock is released. So this approach is
reasonable if you can minimize the lock time for each transaction.
Now that is interesting, because if 100 clients have to go
Tim Daneliuk [EMAIL PROTECTED] wrote:
Is anyone aware of freely available Python modules that can do any of
the following tasks:
1) Given the latitude/longitude of two locations, compute the distance
between them. Distance in this case would be either the straight-line
flying distance,
On 6/22/05, Austin [EMAIL PROTECTED] wrote:
My program is running on windows and it is wrritten by Python and wxPython,
...
Is there any way to dectect windows shutdown or reboot?
Will wx.EVT_END_SESSION or wx.EVT_QUERY_END_SESSION help?
- kv
--
Eloff:
So I think you would need multiple locks so clients only acquire what
they need. This would let multiple threads access the data at once. But
now I have to deal with deadlocks since clients will usually acquire a
resource and then block acquiring another. It is very likely that one
Tim Daneliuk [EMAIL PROTECTED] writes:
1) Given the latitude/longitude of two locations, compute the distance
between them. Distance in this case would be either the straight-line
flying distance, or the actual over-ground distance that accounts for
the earth's curvature.
For
There is an event that win32 sends to each thread to tell it to shut
down. You can grab that with the win32all extension (I am not on
windows right now so I can't look it up in the documentation).
-Chris
On 6/22/05, Konstantin Veretennicov [EMAIL PROTECTED] wrote:
On 6/22/05, Austin [EMAIL
On Wed, 22 Jun 2005 12:34:21 -0500, Rocco Moretti wrote:
scott wrote:
hi people,
can someone tell me, how to use a class like that* (or simulate more
than 1 constructor) :
#--
[snip]
You could also turn __init__ into a dispatch fuction:
#--
class myPointClass:
def
Martin The namespace issue alluded to doesn't exist when using the very
Martin similar approach suggested earlier in this thread by Andrew
Martin Durdin
Sure, but I don't think I want to pay the cost of the exec statement.
if/else would probably be quicker.
-- shown again below in
Casey Hawthorne wrote:
Tim Daneliuk [EMAIL PROTECTED] wrote:
Is anyone aware of freely available Python modules that can do any of
the following tasks:
1) Given the latitude/longitude of two locations, compute the distance
between them. Distance in this case would be either the
Will McGugan wrote:
Thanks for the replies. I think I'm going to go with sqllite for now.
Your list didn't mention a few things that might be critical.
Referential integrity? Type checking? SQLite currently supports
neither. Just make sure you check the list of supported features to see
On 2005-06-22, Scott David Daniels [EMAIL PROTECTED] wrote:
Grant Edwards wrote:
On 2005-06-22, Scott David Daniels [EMAIL PROTECTED] wrote:
Several issues:
(1) The number of distinct NaNs varies among platforms.
According to the IEEE standard, there are exactly two:
signalling and
On 2005-06-22, Paul Rubin http wrote:
Negative 0 isn't a NaN, it's just negative 0.
Right, but it is hard to construct in standard C.
Huh? It's just a hex constant.
Yup. There are two ways to construct a NaN. One is to do
something like (1e300*1e300)/(1e300*1e300) and hope for the
best.
On 2005-06-23, Paul Rubin http wrote:
Scott David Daniels [EMAIL PROTECTED] writes:
Negative 0 isn't a NaN, it's just negative 0.
Right, but it is hard to construct in standard C.
Huh? It's just a hex constant.
Well, -0.0 doesn't work, and (double)0x8000 doesn't work,
and I think
On 2005-06-23, Tim Peters [EMAIL PROTECTED] wrote:
C89 doesn't define the result of that, but most C compilers these
days will create a negative 0.
and (double)0x8000 doesn't work,
I think you meant something like
float f;
*((uint32_t*)d) = 0x;
And I don't know how to test
Hi,
I'm sure I should know this, but I can't find it in the manual.
Is there a function in Python like the function in PHP isset()? It
should take a variable name and return True or False depending on
whether the variable is initialized.
Thanks for any help,
Patrick
--
On 2005-06-23, Grant Edwards [EMAIL PROTECTED] wrote:
On 2005-06-23, Tim Peters [EMAIL PROTECTED] wrote:
C89 doesn't define the result of that, but most C compilers these
days will create a negative 0.
and (double)0x8000 doesn't work,
I think you meant something like
float f;
Hi All--
Tim Peters wrote:
Across platforms with a 754-conforming
libm, the most portable way is via using atan2(!):
pz = 0.0
mz = -pz
from math import atan2
atan2(pz, pz)
0.0
atan2(mz, mz)
-3.1415926535897931
Never fails. Tim, you gave me the best laugh of the day.
Metta,
On 6/23/05, Patrick Fitzsimmons [EMAIL PROTECTED] wrote:
Hi,
I'm sure I should know this, but I can't find it in the manual.
Is there a function in Python like the function in PHP isset()? It
should take a variable name and return True or False depending on
whether the variable is
I'm not sure what you mean by initialized. If you're asking
if the identifier exists in the namespace, then you can use
hasattr(), or simply try to reference it and catch the exception
if it doesn't exist.
If the identifier exists, it always has a value.
On the other hand, there is a small
Using an RDBMS is no cure-all for deadlocks - I can just as easily
deadlock with an RDBMS as with my own threads and locks, probably
easier.
I try to pick up crumbs of knowledge from my co-workers, and one of the
smarter ones gave me this rubric for testing for deadlocks. You need 3
things to
Hi guys,
I'm trying to run this statement:
os.system(r'C:\Program Files\Mozilla Firefox\firefox.exe' + '
www.blendedtechnologies.com')
The goal is to have firefox open to that website.
When I type r'C:\Program Files\Mozilla Firefox\firefox.exe' + '
www.blendedtechnologies.com' in the python
You also want to make sure the frame you want is loaded
I use the following method:
def _frameWait(self, frameName=None):
thisCount = self._timeOut
while self._ie.Busy:
time.sleep(0.1)
thisCount = thisCount - 1
if thisCount == 0: break
Patrick Fitzsimmons wrote:
Hi,
I'm sure I should know this, but I can't find it in the manual.
Is there a function in Python like the function in PHP isset()? It
should take a variable name and return True or False depending on
whether the variable is initialized.
Thanks for any help,
You also may want to fire an event when a button is pressed such as:
ie.Document.forms['f'].elements['btnG'].FireEvent('onClick')
Events:
onclick
Fires when the user clicks the left mouse button on the object.
onsubmit
Fires when a FORM is about to be submitted.
For more go here:
Skip Montanaro wrote:
I wrote PEP 304, Controlling Generation of Bytecode Files:
...
If someone out there is interested in this functionality
and would benefit more from its incorporation into the
core, I'd be happy to hand it off to you.
I am quite interested in this PEP.
What, exactly,
Bugs item #1220113, was opened at 2005-06-14 15:04
Message generated for change (Comment added) made by zenzen
You can respond by visiting:
https://sourceforge.net/tracker/?func=detailatid=105470aid=1220113group_id=5470
Please note that this message will contain a full copy of the comment
Bugs item #1220113, was opened at 2005-06-14 07:04
Message generated for change (Comment added) made by astrand
You can respond by visiting:
https://sourceforge.net/tracker/?func=detailatid=105470aid=1220113group_id=5470
Please note that this message will contain a full copy of the comment
Bugs item #1225059, was opened at 2005-06-21 20:56
Message generated for change (Comment added) made by doerwalter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detailatid=105470aid=1225059group_id=5470
Please note that this message will contain a full copy of the comment
Bugs item #1225059, was opened at 2005-06-21 20:56
Message generated for change (Comment added) made by nlehuen
You can respond by visiting:
https://sourceforge.net/tracker/?func=detailatid=105470aid=1225059group_id=5470
Please note that this message will contain a full copy of the comment
Bugs item #1225059, was opened at 2005-06-21 20:56
Message generated for change (Comment added) made by doerwalter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detailatid=105470aid=1225059group_id=5470
Please note that this message will contain a full copy of the comment
Bugs item #1225705, was opened at 2005-06-22 11:09
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detailatid=105470aid=1225705group_id=5470
Please note that this message will contain a full copy of
Bugs item #1224347, was opened at 2005-06-20 15:22
Message generated for change (Comment added) made by tjreedy
You can respond by visiting:
https://sourceforge.net/tracker/?func=detailatid=105470aid=1224347group_id=5470
Please note that this message will contain a full copy of the comment
101 - 187 of 187 matches
Mail list logo