I'm trying to create multi-threaded WSGI server. But somehow I'm
getting single threaded. What am I doing wrong?
#start myapp.py
from cherrypy.wsgiserver import CherryPyWSGIServer
def my_app(environ, start_response):
print my_app
import time
for i in range(10):
print i
I'm trying to create multi-threaded WSGI server. But somehow I'm
getting single threaded. What am I doing wrong?
#start myapp.py
from cherrypy.wsgiserver import CherryPyWSGIServer
def my_app(environ, start_response):
print my_app
import time
for i in range(10):
print i
On 2008-01-22, citizen Bruno Desthuilliers testified:
from copy import copy
### see also deepcopy
self.lst = copy(val)
What makes you think the OP wants a copy ?
I´m guessing he doesn´t want to mutate original list, while
On 2008-01-18, citizen Zbigniew Braniecki testified:
It's really a nice pitfall, I can hardly imagine anyone expecting this,
AFAIR, it's described in Diving Into Python.
It's quiet elegant way of creating cache.
def calculate(x,_cache={}):
try:
return _cache[x]
On 2008-01-18, citizen J. Peng testified:
hello,
why this happened on my python?
a=3.9
a
3.8999
a = 3.9
print a
3.9
bart
--
PLEASE DO *NOT* EDIT or poldek will hate you. - packages.dir (PLD)
http://candajon.azorragarse.info/ http://azorragarse.candajon.info/
--
On 2008-01-18, citizen Zbigniew Braniecki testified:
I found a bug in my code today, and spent an hour trying to locate it
and then minimize the testcase.
Once I did it, I'm still confused about the behavior and I could not
find any reference to this behavior in docs.
testcase:
class
On 2008-01-20, citizen Arnaud Delobelle testified:
On Jan 20, 3:39 pm, Bart Ogryczak [EMAIL PROTECTED]
to.invalid wrote:
On 2008-01-18, citizen Zbigniew Braniecki testified:
It's really a nice pitfall, I can hardly imagine anyone expecting this,
AFAIR, it's described in Diving Into Python
Hi,
I'm trying to migrate some RD I've done with PHP and RAP[1] to
Python. But I've got hard time finding Python RDF/SPARQL server.
Most things I find are SPARQL clients.
Do you know of a Python library, that could do the job?
[1] http://sites.wiwiss.fu-berlin.de/suhl/bizer/rdfapi/
bart
--
On 23 ago, 13:20, yadin [EMAIL PROTECTED] wrote:
how can i print a sentance containg the string or symbol Ω in python
and also lambda?
Well, you can use this dictionary to find out its unicode code point:
from htmlentitydefs import name2codepoint
unichr(name2codepoint['Omega'])
u'\u03a9'
On 10 ago, 00:11, Lee Sander [EMAIL PROTECTED] wrote:
Hi,
I would like to define a new variable which is not predefined by me.
For example,
I want to create an array called X%s where %s is to be determined
based on the data I am processing. So, for example, if I the file
I'm reading has
g
On 11 jul, 21:08, Ladislav Andel [EMAIL PROTECTED] wrote:
Hi,
I have a list of dictionaries.
e.g.
[{'index': 0, 'transport': 'udp', 'service_domain': 'dp0.example.com'},
{'index': 1, 'transport': 'udp', 'service_domain': 'dp1.example.com'},
{'index': 0, 'transport': 'tcp', 'service_domain':
On 12 jul, 04:49, anethema [EMAIL PROTECTED] wrote:
li = [ {'index': 0, 'transport': 'udp', 'service_domain':
'dp0.example.com'},
{'index': 1, 'transport': 'udp', 'service_domain':
'dp1.example.com'},
{'index': 0, 'transport': 'tcp', 'service_domain':
On 12 jul, 17:23, Jeremy Lynch [EMAIL PROTECTED] wrote:
Hello,
Learning python from a c++ background. Very confused about this:
class jeremy:
list=[]
def additem(self):
self.list.append(hi)
return
temp = jeremy()
On 12 jul, 17:23, Jeremy Lynch [EMAIL PROTECTED] wrote:
Hello,
Learning python from a c++ background. Very confused about this:
class jeremy:
list=[]
You've defined list (very bad choice of a name, BTW), as a class
variable. To declare is as instance variable you have
On Mar 30, 11:56 am, seppl43 [EMAIL PROTECTED] wrote:
Hello there,
does anybody know, how to get the dimension values (width/height) of a
quicktime (.mov) and/or a avi-file?
Is there perhaps a module which can do this job?
Identify from ImageMagick. There is a Python binding (PythonMagick,
On 28 mar, 23:36, Jarek Zgoda [EMAIL PROTECTED] wrote:
Carl Friedrich Bolz napisa³(a):
Welcome to the PyPy 1.0 release - a milestone integrating the results
of four years of research, engineering, management and sprinting
efforts, concluding the 28 months phase of EU co-funding!
So it
On Mar 26, 3:20 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
OK...
I've been told that Both Fortran and Python are easy to read, and are
quite useful in creating scientific apps for the number crunching, but
then Python is a tad slower than Fortran because of its a high level
language
On Mar 21, 8:47 pm, gtb [EMAIL PROTECTED] wrote:
Greetings,
Don't know the daily limit for dumb questions so I will ask one or
more.
In a function I can use the statement n =
sys._getframe().f_code.co_name to get the name of the current
function. Given that I can get the name how can I
On Mar 21, 2:36 pm, flit [EMAIL PROTECTED] wrote:
Now the technical question:
1 - There is a way to make some program in python and protects it? I
am not talking about ultra hard-core protection, just a simple one
that will stop 90% script kiddies.
Freeze. That should be hard enough for 99%
On Mar 21, 3:38 pm, dmitrey [EMAIL PROTECTED] wrote:
Hi all,
I looked to the PEPs didn't find a proposition to remove brackets
commas for to make Python func call syntax caml- or tcl- like: instead
of
result = myfun(param1, myfun2(param5, param8), param3)
just make possible using
result =
On Mar 13, 5:59 pm, Mikael Olofsson [EMAIL PROTECTED] wrote:
If the vendor claims that the DLL is for Windows, is it
reasonable to assume that it can be made to work under Linux, from
Python, that is?
No. It's reasonable to assume, that there is no *easy* way to get
Win32's DLL working under
On Mar 9, 3:30 pm, Lou Pecora [EMAIL PROTECTED] wrote:
Then mymodule is imported only once, but each module has access to it
through the module name (mod1 and mod2) and the alias MM (mod3). Is
that right?
Yes, it is.
I was concerned about multiple imports and efficiency.
If the module is
On Mar 9, 4:27 pm, azrael [EMAIL PROTECTED] wrote:
id like to hear your opinion about something.
I just started using Prolog yesterday and i have my doubts about it,
but it seems to me something like object oriented. so i wanted to ask
you how usefull prolog is.
It's very useful for Logic
On Mar 5, 10:51 am, Piet van Oostrum [EMAIL PROTECTED] wrote:
Bart Ogryczak [EMAIL PROTECTED] (BO) wrote:
BO Any system with 8-bit bytes, which would mean any system made after
BO 1965. I'm not aware of any Python implementation for UNIVAC, so I
BO wouldn't worry ;-)
1965? I worked with non
On Mar 5, 11:22 am, [EMAIL PROTECTED] wrote:
messagesReceived = dict.fromkeys((one,two), {})
This creates two references to just *one* instance of empty
dictionary.
I'd do it like:
messagesReceived = dict([(key, {}) for key in (one,two)])
--
On Mar 1, 7:36 pm, [EMAIL PROTECTED] [EMAIL PROTECTED]
wrote:
On Mar 1, 12:46 pm, Bart Ogryczak [EMAIL PROTECTED] wrote:
This solution looks nice, but how does it work? I'm guessing
struct.unpack will provide me with 8 bit bytes
unpack with 'B' format gives you int value equivalent
On Feb 28, 10:29 pm, John Machin [EMAIL PROTECTED] wrote:
On Mar 1, 4:19 am, BartOgryczak [EMAIL PROTECTED] wrote:
On Feb 28, 3:53 pm, John Machin [EMAIL PROTECTED] wrote:
On Feb 28, 10:38 pm, BartOgryczak [EMAIL PROTECTED] wrote:
[1] eg. consider calculating interests rate, which
On Mar 1, 7:52 am, [EMAIL PROTECTED] [EMAIL PROTECTED]
wrote:
It seems like this would be easy but I'm drawing a blank.
What I want to do is be able to open any file in binary mode, and read
in one byte (8 bits) at a time and then count the number of 1 bits in
that byte.
I got as far as
On Mar 1, 4:58 pm, [EMAIL PROTECTED] [EMAIL PROTECTED]
wrote:
On Mar 1, 8:53 am, Bart Ogryczak [EMAIL PROTECTED] wrote:
On Mar 1, 7:52 am, [EMAIL PROTECTED] [EMAIL PROTECTED]
wrote:
It seems like this would be easy but I'm drawing a blank.
What I want to do is be able to open any
On Feb 27, 7:58 pm, Arnaud Delobelle [EMAIL PROTECTED] wrote:
On 27 Feb, 14:09, Bart Ogryczak [EMAIL PROTECTED] wrote:
On Feb 27, 1:36 pm, Facundo Batista [EMAIL PROTECTED] wrote:
Arnaud Delobelle wrote:
(and I don't want the standard Decimal class :)
Why?
Why should you
It seems, that on Solaris cPickle is unable to unpickle some values,
which it is able to pickle.
import cPickle
cPickle.dumps(1e-310)
'F9.9694e-311\n.'
cPickle.loads(_)
Traceback (most recent call last):
File stdin, line 1, in ?
ValueError: could not convert string to float
On Feb 28, 3:53 pm, John Machin [EMAIL PROTECTED] wrote:
On Feb 28, 10:38 pm, BartOgryczak [EMAIL PROTECTED] wrote:
[1] eg. consider calculating interests rate, which often is defined as
math.pow(anualRate,days/365.0).
In what jurisdiction for what types of transactions? I would have
On Feb 28, 6:34 pm, Arnaud Delobelle [EMAIL PROTECTED] wrote:
So as long as you're dealing with something like
invoices, Decimal does just fine. When you start real calculations,
not only scientific, but even financial ones[1], it doesn't do any
better then binary float, and it's bloody
On Feb 27, 1:36 pm, Facundo Batista [EMAIL PROTECTED] wrote:
Arnaud Delobelle wrote:
(and I don't want the standard Decimal class :)
Why?
Why should you? It only gives you 28 significant digits, while 64-bit
float (as in 32-bit version of Python) gives you 53 significant
digits. Also note,
On Feb 25, 10:25 pm, [EMAIL PROTECTED] wrote:
Hello everybody,
I have a (hopefully) simple question about scoping in python. I have a
program written as a package, with two files of interest. The two
files are /p.py and /lib/q.py
My file p.py looks like this:
---
from lib import q
def
On Feb 26, 2:03 pm, Daniel Nogradi [EMAIL PROTECTED] wrote:
Something funny:
The new programming model of NVIDIA GPU's is called CUDA and I've
noticed that they use the same __special__ notation for certain things
as does python. For instance their modified C language has identifiers
such as
On Feb 22, 3:22 pm, Fabian Steiner [EMAIL PROTECTED] wrote:
Now I am wondering if there isn't any better method which would be more
general. In fact, I think of something like a python version of ping
which only tries to send ICMP packets.
Server or a firewall in between most probably will
On Feb 21, 5:09 am, Astan Chee [EMAIL PROTECTED] wrote:
Hi,
I just tried to do
eval('00052') and it returned 42.
Is this a known bug in the eval function? Or have I missed the way eval
function works?
It works just fine. Read up on integer literals.
52 #decimal
52
052 #octal
42
0x52
On Feb 16, 4:30 pm, stdazi [EMAIL PROTECTED] wrote:
for (i = 0; some_function() /* or other condition */ ; i++)
C's for(pre,cond,post) code is nothing more, then shorthand form of
pre; while(cond) {code; post;}
Which translated to Python would be:
pre
while cond:
code
post
--
On Feb 14, 11:28 pm, [EMAIL PROTECTED] [EMAIL PROTECTED]
wrote:
Hello,
I searched on Google and in this Google Group, but did not find any
solution to my problem.
I'm looking for a way to output stdout/stderr (from a subprocess or
spawn) to screen and to at least two different files.
eg.
On Feb 14, 9:41 pm, Bernard Lebel [EMAIL PROTECTED] wrote:
This is taking a long time, and I'm looking for ways to speed up this
process. I though that keeping the list in memory and dropping to the
file at the very end could be a possible approach.
It seems, that you're trying to reinvent
On Feb 14, 6:12 pm, Steve [EMAIL PROTECTED] wrote:
I'm trying to create a list range of floats and running into problems.
I've tried it the easy way. Works.
map(float,range(a,b))
--
http://mail.python.org/mailman/listinfo/python-list
On Feb 9, 8:49 am, Deniz Dogan [EMAIL PROTECTED] wrote:
Hello.
I was thinking about writing a UNIX shell program using Python. Has
anyone got any experience on this? Is it even possible?
Use the Google, Luke.
http://sourceforge.net/projects/pyshell/
--
On Feb 6, 11:47 am, Johny [EMAIL PROTECTED] wrote:
Where and when is good/nescessary to use `repr` instead of `str` ?
Can you please explain the differences
Thanks
RTFM. http://docs.python.org/ref/customization.html
__repr__( self)
Called by the repr() built-in function and by string
On Jan 7, 10:11 pm, Jussi Salmela [EMAIL PROTECTED] wrote:
gonzlobo kirjoitti:
Curious if anyone has a python cheatsheet* published? I'm looking for
something that summarizes all commands/functions/attributes. Having
these printed on a 8 x 11 double-sided laminated paper is pretty
cool.
On Jan 7, 10:03 pm, gonzlobo [EMAIL PROTECTED] wrote:
Curious if anyone has a python cheatsheet* published? I'm looking for
something that summarizes all commands/functions/attributes. Having
these printed on a 8 x 11 double-sided laminated paper is pretty
cool.
* cheatsheet probably isn't
On Jan 7, 1:07 am, [EMAIL PROTECTED] [EMAIL PROTECTED]
wrote:
Coming from a C++ / C# background, the lack of emphasis on private data
seems weird to me. I've often found wrapping private data useful to
prevent bugs and enforce error checking..
It appears to me (perhaps wrongly) that Python
On Feb 1, 3:42 am, [EMAIL PROTECTED] wrote:
How to divide a number by 7 efficiently without using - or / operator.
We can use the bit operators. I was thinking about bit shift operator
but I don't know the correct answer.
It´s quiet simple. x == 8*(x/8) + x%8, so x == 7*(x/8) + (x/8 + x%8)
On Feb 2, 2:55 pm, ardief [EMAIL PROTECTED] wrote:
Hi everyone
Here is my problem:
I have a list that looks like this -
[['a', '13'], ['a', '3'], ['b', '6'], ['c', '12'], ['c', '15'], ['c',
'4'], ['d', '2'], ['e', '11'], ['e', '5'], ['e', '16'], ['e', '7']]
and I would like to end up with
On Feb 2, 3:19 pm, Larry Bates [EMAIL PROTECTED] wrote:
l=[x for x in d.items()]
d.items() is not an iterator, you don´t need this. This code is
equivalent to l = d.items().
--
http://mail.python.org/mailman/listinfo/python-list
On Feb 1, 2:00 pm, Nicko [EMAIL PROTECTED] wrote:
precision and the answer that they were looking for was:
a = (b * 045L) 32
Note that the constant there is in octal.
045L? Shouldn´t it be 044?
Or more generally,
const = (1bitPrecision)/7
a = (b *
Hi,
I´m looking for some benchmarks comparing SWIG generated modules with
modules made directly with C/Python API. Just how much overhead does
SWIG give? Doing profile of my code I see, that it spends quiet some
time in functions like _swig_setattr_nondinamic, _swig_setattr,
_swig_getattr.
--
On Feb 1, 12:12 pm, Phil Thompson [EMAIL PROTECTED]
wrote:
On Thursday 01 February 2007 10:21 am, Bart Ogryczak wrote:
Hi,
I´m looking for some benchmarks comparing SWIG generated modules with
modules made directly with C/Python API. Just how much overhead does
SWIG give? Doing profile
On Feb 1, 12:48 pm, Diez B. Roggisch [EMAIL PROTECTED] wrote:
Yeah, found that one googling around. But I haven´t fund anything more
up to date. I imagine, that the performance of all of these wrappers
has been improved since then. But the performance of Python/C API
would too?
Anyways,
On Feb 1, 5:52 pm, Steven W. Orr [EMAIL PROTECTED] wrote:
I saw this and tried to use it:
--8--- const.py-
[...]
sys.modules[__name__]=_const()
__name__ == 'const', so you´re actually doing
const = _const()
--
Hi,
I'm developing mixed Python/C app which runs on WinNT server. When
something fails in Python, that´s not a problem, prints a traceback to
the log and thats it. When something fails within the C code, the error
message window pops up. To kill it I´ve got to access server with VNC.
I´ve tried
Grant Edwards wrote:
On 2006-11-29, Bart Ogryczak [EMAIL PROTECTED] wrote:
Fredrik Lundh wrote:
Bart Ogryczak wrote:
I´ve got this problem with pickle, it seems it doesn´t handle
correctly infinite values (nor does Python return overflow/underflow
error).
Python 2.X relies
Hello,
I´ve got this problem with pickle, it seems it doesn´t handle
correctly infinite values (nor does Python return overflow/underflow
error). What could I do about it? Example code:
x = 1e310 #actually it would be a result of calculations
type(x)
type 'float'
x
1.#INF
import pickle
To make things more interesting -- Solaris version:
x = 1e310
x
Infinity
import pickle
pickle.dumps(x)
'FInfinity\n.'
pickle.loads(_)
Infinity
pickle.dumps(x,1)
[...]
SystemError: frexp() result out of range
--
http://mail.python.org/mailman/listinfo/python-list
Sebastian Bassi wrote:
I am writing a paper where I refer to Python. Is there a paper that I
can refer the reader to? Or just use the Python web page as a
reference?
I´d refer to The Python Language Reference Manual, Guido Van Rossum,
Fred L., Jr. Drake
Network Theory Ltd (September 2003),
Fredrik Lundh wrote:
Bart Ogryczak wrote:
I´ve got this problem with pickle, it seems it doesn´t handle
correctly infinite values (nor does Python return overflow/underflow
error).
Python 2.X relies on the C library to serialize floats, and, as you've
noticed, some C libraries can
Dennis Lee Bieber wrote:
f-i-* creates local names initially bound to the objects inside a
module, but any assignment to such a name later results in the name
being rebound to the new object -- disconnecting from the original.
Great! That was it. Thank you! :-)
--
Hi,
I´ve got a problem creating persistent cache, that would be shared
between modules. There a supermodule, which calls submodules. I´d like
submodules to use cache created in the supermodule. The only way I see
right now, is to pass it as function argument, but that would require a
change in
Fredrik Lundh wrote:
Bart Ogryczak wrote:
I´ve got a problem creating persistent cache, that would be shared
between modules. There a supermodule, which calls submodules. I´d like
submodules to use cache created in the supermodule. The only way I see
right now, is to pass it as function
Hi,
Rigth now I'm using two IDEs for Python, KDevelop and Eric. Both have
drawbacks. KDevelop is a multilanguage IDE, and doesn't really have
anything special for Python. There's no Python debugger, no PyDOC
integration, it's class browser doesn't display attributes. On the
other side there's
Diez B. Roggisch wrote:
Bart Ogryczak schrieb:
Hi,
Rigth now I'm using two IDEs for Python, KDevelop and Eric. Both have
drawbacks. KDevelop is a multilanguage IDE, and doesn't really have
anything special for Python. There's no Python debugger, no PyDOC
integration, it's class browser
66 matches
Mail list logo