that for my application to work,
>P> # Python newbies would have to write lambda when they
>P> # know they are after the result. Its my program
>P> # that would require the lambda (or def), which
>P> # is a distraction from their problem.
>P> Any ideas on imp
hon\lib\pyx\dvifile.py", line 386, in
>oc> readfontmap
>oc> raise RuntimeError("cannot find font mapping file '%s'" %
>oc> filename)
>oc> RuntimeError: cannot find font mapping file 'psfonts.map'
>oc> """
>oc> I have setuped pyx i wonder i have mistake?
Do you have TeX installed?
--
Piet van Oostrum <[EMAIL PROTECTED]>
URL: http://www.cs.uu.nl/~piet [PGP 8DAE142BE17999C4]
Private email: [EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
be called just 'TeX' because these new versions contain extensions. So
they get new names with 'tex' being part of their name. PdfTeX and LuaTeX
are new versions that are being developed right now.
--
Piet van Oostrum <[EMAIL PROTECTED]>
URL: http://www.cs.uu.nl/~pie
upport. it would be really nice and easy for me to use
>>> python instead of javascript to write those ajax scripts.
>>>
>>> Please tell me, is there a python substitude for JRE ?
>k> You can also use Python's cgi module. It's pretty cool, from what I&
http://hea-www.harvard.edu/~fine/Tech/addrinuse.html
or the Unix socket FAQ (http://www.faqs.org/faqs/unix-faq/socket/) 2.7
Normally the solution is to set the SO_REUSEADDR option in the socket (the
original one) before binding it:
s.setsockopt(socket.SOL_SOCKET,socket.SO_REUSEADDR,1)
However, SOAP
e
long strings it would be better to use join.
--
Piet van Oostrum <[EMAIL PROTECTED]>
URL: http://www.cs.uu.nl/~piet [PGP 8DAE142BE17999C4]
Private email: [EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
ives you only 1 item instead of 2.
So add the following:
if not line: break
Also your choice for 0 as initial values of minimum and maximum isn't good.
--
Piet van Oostrum <[EMAIL PROTECTED]>
URL: http://www.cs.uu.nl/~piet [PGP 8DAE142BE17999C4]
Private email: [EMAIL P
luding the
MessageBox, on Tiger with python 2.5.1. I run the in Terminal (pythonw
python_compare.py) both with and without your PYTHONPATH.
How did you run the examples?
--
Piet van Oostrum <[EMAIL PROTECTED]>
URL: http://www.cs.uu.nl/~piet [PGP 8DAE142BE17999C4]
Private email: [EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
>>>>> "Adrian Cherry" <[EMAIL PROTECTED]> (AC) wrote:
>AC> For that matter C# is no better, I thought that # was pronounced
>AC> hash, I still refer to C# as C-hash.
Are you musically illiterate?
--
Piet van Oostrum <[EMAIL PROTECTED]>
URL
>>>>> Deltantor <[EMAIL PROTECTED]> (D) wrote:
>D> Does c.l.python get religious spam that much? Of all of the places to be
>D> spammed the least likely I expected would be here.
Is that the reason you find it necessary to repeat it?
--
Piet van Oost
>>>>> "Adrian Cherry" <[EMAIL PROTECTED]> (AC) wrote:
>AC> Piet van Oostrum <[EMAIL PROTECTED]> wrote in
>AC> news:[EMAIL PROTECTED]:
>>>>>>>> "Adrian Cherry" <[EMAIL PROTECTED]> (AC) wrote:
>>>
spite
>SD> the lack of JIT compilers.
The above is not a description of the language but of an implementation.
Albeit the currently major implementation. But it could be that in the
future python would be compiled to machine code. That wouldn't change the
language.
--
Piet van Oostrum
".pdf"
>JN> file by invoking OpenOffice via CORBA. At least in theory, this is
>JN> possible. All the necessary parts supposedly exist. Somebody
>JN> tried back in 2003, but gave up. See
>JN> "http://mail.python.org/pipermail/python-list/2003-April/198094.h
anslation of the introduction of
the law). Otherwise someone else could publish it if he got hold of it in
some legitimate way.
--
Piet van Oostrum <[EMAIL PROTECTED]>
URL: http://www.cs.uu.nl/~piet [PGP 8DAE142BE17999C4]
Private email: [EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
nobody dares copy them lest the
>SD> unknown copyright owners descend like vultures and sue you for
>SD> copyright infringement *after* you've done the hard work of restoring
>SD> our cultural heritage.
Our (Dutch) copyright law has a specific exemption for this particular
cas
nd read the PNG output back.
However you must be aware that this can deadlock if the output is large
enough. So putting the input or the output in a real file is probably safer
anyway.
--
Piet van Oostrum <[EMAIL PROTECTED]>
URL: http://www.cs.uu.nl/~piet [PGP 8DAE142BE17999C4]
Private emai
ample M and the mutex for the Queue
should be the same to solve the problem. And that the Queue API should
allow you to do that. I think he is right.
--
Piet van Oostrum <[EMAIL PROTECTED]>
URL: http://www.cs.uu.nl/~piet [PGP 8DAE142BE17999C4]
Private email: [EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
How can I get ahold of all the out and err joined synchronously in the
>R> order, it is created ?
Make sure that myapp writes it synchronously. Probably myapp has it
buffered, so it writes out at the end of the run. It is not caused by
python.
--
Piet van Oostrum <[EMAIL PROTECTED]&
class
>PL> instantiation.
What do you mean 'variables in the class namespace'? Which variable is in
the class namespace? Please note that you can access variables in the class
namespace:
class MyClass:
a = 10
b = 20
def my_method(self, param1=a, param2=b):
rty of symbols but of values. So it doesn't make
sense to declare an identifier to be immutable. And mutability is tied to
the object's type, not to individual instances.
What you want can only be obtained if Python would have an immutable
variant for each type or would add an immuta
>>>>> Edward Elliott <[EMAIL PROTECTED]> (EE) wrote:
>EE> Piet van Oostrum wrote:
>>>>>>>> [EMAIL PROTECTED] (T) wrote:
>>>
>T> As you can see, the "constant" A can be modified this easily. But if
>T> there were a
>>>>> Heiko Wundram <[EMAIL PROTECTED]> (HW) wrote:
>HW> y.py
>HW> ---
>HW> from x import test
>HW> print test.one
>HW> print test.two
>HW> print test.three
>HW> ---
Or even:
import x
x = x.test
print x.one
print x.two
pr
'm looking at XML-RPC, RPyC,
>CJVA> CORBA, and Twisted.
Although it doesn't cover exactly the technologies mentioned above
the following article may be interesting for you:
Python Web services developer: Messaging technologies compared
http://www.ibm.com/developerworks
>>>>> Heiko Wundram <[EMAIL PROTECTED]> (HW) schreef:
>HW> from x import test as x
>HW> print x.one
>HW> print x.two
>HW> print x.three
Or replace test by x in x.py :=)
--
Piet van Oostrum <[EMAIL PROTECTED]>
URL: http://www.cs.uu.nl/~piet [PG
o this ?
AFAIK PDF doesn't have the concept of "Chapter". If the document has an
outline, you could try to use the first level of that hierarchy as the
chapter starting points. But you don't have a guarantee that they really
are chapters.
--
Piet van Oostrum <[EMAIL PROTEC
own encoding: mbcs
>>>>>
>M> Hmmn, strange. Same behaviour for "raboof".
Apparently for the empty string the encoding is irrelevant as it will not
be used. I guess there is an early check for this special case in the code.
--
Piet van Oostrum <[EMAIL PROTECTED]>
URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4]
Private email: [EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
> bukzor <[EMAIL PROTECTED]> (B) wrote:
>B> Why cant you implement < for complex numbers? Maybe I'm being naive,
>B> but isn't this the normal definition?
>B> a + bi < c + di iff sqrt(a**2 + b**2) < sqrt(c**2, d**2)
There doesn't exist a `normal' definition of < for the complex numbers. F
a toString method it is OK. This is special-cased in the compiler. It is
defined in the language definition, not in the library definition.
--
Piet van Oostrum <[EMAIL PROTECTED]>
URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4]
Private email: [EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
>BV> import time
>BV> print " Starting app 1"
>BV> time.sleep(1)
>BV> try:
>BV> p1 = Popen(["C:\Program Files\Microsoft Office\OFFICE11\OUTLOOK.EXE"],
Use raw strings or escape the \'s.
--
Piet van Oostrum <[EMAIL PROTECTED]>
URL: http
r\u00f8ya".decode('latin-1')
>DR> but to no avail.
You have to use encode instead of decode, and the input string must be a
unicode string.
>>> print u"Fr\u00f8ya".encode('latin-1')
Frøya
>>>
--
Piet van Oostrum <[EMAIL PROTECTED]>
ompiler has performed the further smattering of semantically puny
>GG> 'verifications' allowed by mandatory-declaration, stating-typing
>GG> languages?" - Alex Martelli
I couldn't find the original of this. I would like to see it in its
context. Googling didn't reveal
is more than one representation that has
this property. I would guess (but didn't check) that
53.6010001 also gives the same number. From all these
representations it would be best to choose the simplest one, i.e. 53.6.
This problem and a solution has been described in one
>>>>> Peter Otten <[EMAIL PROTECTED]> (PO) wrote:
>PO> Piet van Oostrum wrote:
>>>>>>>> "Gabriel Genellina" <[EMAIL PROTECTED]> (GG) wrote:
>>>
>GG> "Given this indispensable process and architecture issue
>>>>> Dennis Lee Bieber <[EMAIL PROTECTED]> (DLB) wrote:
>DLB> On Fri, 07 Mar 2008 23:12:27 +0100, Piet van Oostrum <[EMAIL PROTECTED]>
>DLB> declaimed the following in comp.lang.python:
>>> Sorry to come in so late in this discussion. Although
will have to change the sys.path before the
import, e.g. in your main program. Or do what is usually done: put
MyPackage in the site-packages directory.
--
Piet van Oostrum <[EMAIL PROTECTED]>
URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4]
Private email: [EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
accuracy".
>GG> A stopped clock shows the right time twice a day; a clock that loses one
>GG> minute per day shows the right time once every two years. Clearly the
>GG> stopped clock is much better!
But if the answer is incorrect (in the float calculation) the error is
limited. IEEE 754 prescribes that the error should be at most 1 LSB, IIRC.
And then the number of errors is the proper measure.
--
Piet van Oostrum <[EMAIL PROTECTED]>
URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4]
Private email: [EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
#x27;t test with `is' but with `=='.
>g> return x
>g> else: print "No String for you...False!"
>g> def SendMethod(request):
>g> xstring = "Some text"
>g> ReturnMethod(request, xstring)
>g> SendMethod(&
nes, i.e give each machine half of the
> slices and let it run them in threads as described above. Is there an
> easy way, or an article on this matter you can point me to?
Have a look at MapReduce (google for MapReduce Python).
--
Piet van Oostrum
URL: http://pietvanoostrum.com [PGP 8DAE142BE1
values() might also work, but I am not sure whether d.keys() and
>AE> d.values() are guaranteed to use the same order.
Yes, they are if the dictionary is not changed in the meantime (not even
inserting and removing the same thing). See the library documentation,
section dict.
--
Piet v
wobj = OtherType(arg)
self.add(newobj)
class SomeType(object):
def __init__(self):
pass
class OtherType(SomeType):
def __init__(self, arg):
SomeType.__init__(self)
self.x = arg
cA = Container()
obA = cA.SomeType()
obB = cA.OtherType(5)
print cA.items
--
Piet van
27;]
>O> for i in range(0,self.times):
>O> for site in sites:
>O> self.name = site
>O> self.html=SendRequest() # This line throws an error
self.html=self.SendRequest()
--
Piet van Oostrum
URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4]
Private email: p...@vanoostrum.org
--
http://mail.python.org/mailman/listinfo/python-list
en use
objList.append(temp)
here and
objList = [] before the loop.
>S> How can I do that? I am a beginner to Python. Any help would be
>S> appreciated.
You can use pickle to store the list is a file after reading.
Something like (untested):
imp
; section but not a lot.
It is explained in The Python Language Reference, chapter Expressions,
section Comparisons. At least that's were it is in the 2.6 doc.
--
Piet van Oostrum
URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4]
Private email: p...@vanoostrum.org
--
http://mail.python.org/mailman/listinfo/python-list
e in different locations but that should not matter. The
real differences are:
1. The order of the parameters is different. This could well be the
problem if the server is not paying attention to the parameter names
but only to the order.
2. The types are included in Python. this is the RPC.
made copies of the inner lists and these are the important
ones. So the reverse will reverse the *original* inner lists which are
both in ll and in l.
If you still want to do destructive reverses on the inner list you
should make a deep copy:
>>> import copy
>>> l = copy.deepcopy(
any processes running or you have too little
swap space.
Maybe you can have a `top' process running or run `ps' occasionally to
see how many processes there are and how big they are. Moving files from
a local file system to a network file system means copying and maybe
the mv tries to copy the files in very large chunks.
What you could do is to put the filenames in a work queue when your
Fortran program has finished and run a separate thread that moves the
files one by one.
--
Piet van Oostrum
URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4]
Private email: p...@vanoostrum.org
--
http://mail.python.org/mailman/listinfo/python-list
iptor#implementing-descriptors
(Actually, IIRC, the function object is its own descriptor)
>>> class C(object):
... def method(self):
... pass
...
>>> c=C()
>>> C.__dict__['method']
>>> C.__dict__['method'].__get__
>>> C.__dict
before all other readers have
finished. You need at least one more lock and probably a writer
counter to solve this.
3. See also http://code.activestate.com/recipes/465156/
4. The code has not been tested, not even for syntax errors.
--
Piet van Oostrum
URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4]
Private email: p...@vanoostrum.org
--
http://mail.python.org/mailman/listinfo/python-list
scription from Gideon's thesis, put it in a small Haskell
program and now I can easily try it out.
--
Piet van Oostrum
URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4]
Private email: p...@vanoostrum.org
--
http://mail.python.org/mailman/listinfo/python-list
would be the natural
>DBR> choice anyway) they can block the writer from writing alltogether.
>DBR> Or do I miss something here?
Yes, you missed note 2 at the end of my posting.
--
Piet van Oostrum
URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4]
Private email: p...@vanoostrum.org
--
http://mail.python.org/mailman/listinfo/python-list
nd “writers”, Communications of the ACM, v.14 n.10,
p.667-668, Oct. 1971
[2] Jalal Kawash, Process Synchronization with Readers and Writers
Revisited Journal of Computing and Information Technology - CIT 13,
2005, 1, 43–51
[3] http://pages.cs.wisc.edu/~haryadi/537/slides/lec18-semaphores.ppt
[4] http://vorlon.case.edu/~jrh23/338/HW3.pdf
--
Piet van Oostrum
URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4]
Private email: p...@vanoostrum.org
--
http://mail.python.org/mailman/listinfo/python-list
>>>>> "tleeuwenb...@gmail.com" (tc) wrote:
>tc> What, exactly, needs to be in place for an object to be a valid
>tc> dictionary key?
It must have __hash__ and __cmp__ or __eq__ methods. Newstyle classes
inherit these from object.
--
Piet van Oostrum
tion is definately returning different dictionaries each
>sn> time as I can see that when I print them.
>sn> I know this is something to do with the dictionries being stored as
>sn> references but I've no idea how to fix it seeing as the copy()
>sn> function didn
ke sense?
Not much. As 1.1^2=1.21, I would think this would then take 2
datapoints, not 4. If you take at each step n = 1.1^n (rounded up) n
will stay at 2 forever.
And first you talk about rounding down, later about rounding up. So what
is it.
Maybe you should give a better specifica
k()
pool = multiprocessing.Pool(processes=5)
for i in xrange(100):
pool.apply_async(func=RunFunc, args=(i,lock))
pool.close()
pool.join()
--
Piet van Oostrum
URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4]
Private email: p...@vanoostrum.org
--
http://mail.python.org/mailman/listinfo/python-list
len(line) == 30:
f1 = float(line[0:10])
f2 = float(line[10:20])
f3 = float(line[20:30])
print f1,f2,f3
else:
print("Sorry, I don't understand this format: %s" % line)
--
Piet van Oostrum
URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4]
Private email: p...@vanoostrum.org
--
http://mail.python.org/mailman/listinfo/python-list
gt; return "Group2"
>DD> def _SubGroup(superclass):
>DD> class SubGroup(superclass):
>DD> pass
>DD> return SubGroup
>DD> SubGroup = _SubGroup(Group2)
What is the difference of this with:
class SubGroup(Group2):
pass
?
&
MD> an exception.
That is so because 'all' and 'any' are reduce (or fold) operations on the
logical operations 'and' and 'or', respectively. And the reduce
operation on an empty sequence should be the identity of the underlying
operation. The identity of '
2
>>> x.value = -3.14
>>> print x
-3.14
>>> sin(x)
-0.0015926529164868282
>>> x + 1
-2.1401
>>> y = Float(7.0, 0.3)
>>> print y
7.0
>>> x + y
3.8599
>>>
If you write your own functions they might have to coerce your Float
objects to real floats ocassionally by using float(param) instead of
param.
--
Piet van Oostrum
URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4]
Private email: p...@vanoostrum.org
--
http://mail.python.org/mailman/listinfo/python-list
ot;
signal.signal(signal.SIGALRM, handler)
def execute(command, timeout):
signal.alarm(timeout);
try:
exec(command)
except AlarmError, e:
print e
print 'Aborted "%s"' % (command,)
print "continue work"
print "The everlas
>>>>> eric.le.bi...@spectro.jussieu.fr (ELB) wrote:
>ELB> To Dave A. and Piet: I appreciate your taking the time to make
>ELB> suggestions. I understand that there is a hitch in the approach that
>ELB> you describe, which I would like to insist on: how do yo
at is something Python does not support. That also would
be very close to C++'s ref (&) parameters.
--
Piet van Oostrum
URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4]
Private email: p...@vanoostrum.org
--
http://mail.python.org/mailman/listinfo/python-list
(only 6 chars more per def):
def airdensity(T): return 10/(287*T)
air=material(airdensity)
def steeldensity(T): return interp(T,[0,1000],[7856,7813])
steel=material(steeldensity)
def rockdensity(T): return 5000
rock=material(rockdensity)
--
Piet van Oostrum
URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4]
Private email: p...@vanoostrum.org
--
http://mail.python.org/mailman/listinfo/python-list
nalcode)
def execute(command, timeout):
threading.Timer(timeout, interrupt).start()
try:
exec(command)
except AlarmError, e:
print e
print 'Aborted "%s"' % (command,)
print "continue work"
print "The everlasting command"
JM> @ OP: These are very reasonable interpretations of "all same" and "all
>JM> different" but of course can both return False for the same input.
They can even both return True for the same input!
--
Piet van Oostrum
URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4]
Private email: p...@vanoostrum.org
--
http://mail.python.org/mailman/listinfo/python-list
g> is
>g> a
>g> test
>g> done
>g> [3]+ Stopped python
>g> [cdal...@localhost ~]$ kill %3
>g> It appears that only item = queue.get() called. Ie, the block never
>g> advances to if item == 'done':
>g> like in the first e
e programm finishes. Since the
>RR> output of the programm is used to generate a progress indicator, I need
>RR> a way to acces the values written to stdout/stderr as fast as possible.
>RR> print p.stderr.read()
Use p.stderr.readline() or p.stderr.read(1) in a loop.
--
Piet va
atsnew/2.6.html
>BW> Source tarballs, Windows installers, and (soon) Mac OS X disk images can
>BW> be downloaded from the Python 2.6.2 page:
>BW> http://www.python.org/download/releases/2.6.2/
Maybe a link to the MacOSX image can also be added to
http://www.python.or
t; import myscript
>S> for i in range(1,n):
>S>myscript.func??
Others have suggested getattr. I think a cleaner (more pythonic) way
would be:
funclist = [func01, func02, func03, ... ]
for i in range(1,n):
funclist[i]()
Or myscript.funclist[i]() from another module.
-
_init__(self,x)
>R> and I cannot even get this to pickle right.
>>>> w=Mylist([1,2,3])
>>>> dumps(w)
>R> PicklingError: Can't pickle : attribute lookup
>R> __main__.p fa
>R> iled
Where does the 'p' come from?
What is w.__
ou just take two files, not
fabricated to collide, the probability of them having the same hash
under MD5 is 2**-128 which I think is way smaller than the probability
of the bit representing the answer being swapped by some physical cause
in your computer. But then again, it doesn't make sen
__repaint()
|t = time.time()
|self._mod_lock.release()
|print >> sys.stderr, "at loop end"
|self._mod_lock.acquire()
`
Your loop ends with self._mod_lock.acquire() but in the next round there
is another self._mod_lock.acquire() at the
it continues because the timeout has expired.
>GG> Please file a bug report at http://bugs.python.org/
It is not a bug. I see the Hello World temporarily suspended and then
continuing. That's how it should be.
--
Piet van Oostrum
URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4]
Private email: p...@vanoostrum.org
--
http://mail.python.org/mailman/listinfo/python-list
>>>>> stephane.bisin...@gmail.com (SB) wrote:
>SB> On Apr 18, 10:24 am, Piet van Oostrum wrote:
>>>
>>> I haven't run it (too much hassle to setup) but I noticed one strange
>>> thing in your code:
>>>
>>> ,
>
_special_object(list, [1,2,3])
>>> a
[1, 2, 3]
>>> a.__class__
>>> a.__class__.__nonzero__ = lambda self: False
>>> bool(a)
False
>>> a.__nonzero__()
False
>>> a.append(4)
>>> a
[1, 2, 3, 4]
>>>
--
Piet van Oostrum
URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4]
Private email: p...@vanoostrum.org
--
http://mail.python.org/mailman/listinfo/python-list
ide that confusing
>SD> variables and attributes of variables was a good thing? What's next,
>SD> describing dictionary keys as "dictionary variables"?
If you google for '"instance variable" python' you get quite a number of
hits, not only recent ones.
gt;M> 6
>>>>>
>M> Why doesn't "a + 2" look up the __add__ attribute and use my lambda?
>M> If I manually define __add__(self, other) then "a + 2" will of course
>M> use that method.
This has just been discussed in the thread "Ov
line 1, in
AttributeError: 'module' object has no attribute 'handlers'
>>> import logging.handlers
>>> logging.handlers
>>>
'logging' is a package. The 'logging' module does not contain a
definition of 'handlers' but there is a modul
gtk in contact_list.py. Then it should work.
By the way, I wonder why you need a timeout in your wait. I think the
notifications should be sufficient to keep the gui updated.
--
Piet van Oostrum
URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4]
Private email: p...@vanoostrum.org
--
http://
;
self.__repaint()
t = time.time()
But the timeout thing will continue after that, so you have a continuous
polling loop which wastes some CPU time. I think what you want can be
more easily achieved by doing a sleep(0.5) before the outer while loop,
i.e. as the firs
a list of pairs, but demonstrates the general idea.
This will fail if there are duplicates in the items. And if we assume no
duplicates the key doesn't need the k part:
sorted_items = sorted(d.iteritems(), key=lambda (k,v): v)
or
from operator import itemgetter
sorted_items = sorted(d.iteritem
et from the second queue. The lookup
thread could even do caching of the results if you often have to repeat
the pings for thew same host.
--
Piet van Oostrum
URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4]
Private email: p...@vanoostrum.org
--
http://mail.python.org/mailman/listinfo/python-list
]+[-A-Za-z]|-+[0-9A-Za-z])[-0-9A-Za-z]*')
>>> re.findall(obj, 'TestThis;1234;Test123AB-x')
['Test123AB-x']
Or you can use re.I and mention only one case of letters:
obj = re.compile(r'(?:[a-z]+[-0-9]|[0-9]+[-a-z]|-+[0-9a-z])[-0-9a-z]*', re.I)
--
Piet van
to expect --PARAM1 and --
>L> PARAM2
See the doc:
Some other option syntaxes that the world has seen include:
[...]
* a hyphen followed by a whole word, e.g. "-file" [...]
These option syntaxes are not supported by optparse, and they never will be.
--
Piet van Oostrum
URL:
>>>>> John Machin (JM) wrote:
>JM> On Apr 24, 1:29 am, Piet van Oostrum wrote:
>>> obj = re.compile(r'(?:[a-z]+[-0-9]|[0-9]+[-a-z]|-+[0-9a-z])[-0-9a-z]*',
>>> re.I)
>JM> Understandable and maintainable, I don't think. Suppo
b = [2, 3+4j, 1]
>>> set(a) == set(b)
True
>>> sorted(a)==sorted(b)
Traceback (most recent call last):
File "", line 1, in
TypeError: no ordering relation is defined for complex numbers
In Python 3 there are even more incomparable objects pairs.
--
Piet van Oostrum
URL
_children = obj
What is the added value of using a property for the children attribute?
Why not just use an instance variable directly? Also a Java inheritance?
--
Piet van Oostrum
URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4]
Private email: p...@vanoostrum.org
--
http://mail.python.org/mailman/listinfo/python-list
eases of pygtk are
still built with Numeric instead of numpy. In SVN it has been converted
to use Numpy instead, so then type(pb_pixels) would also be
'numpy.ndarray' and no conversion would be necessary.
So try to install the version from SVN.
--
Piet van Oostrum
URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4]
Private email: p...@vanoostrum.org
--
http://mail.python.org/mailman/listinfo/python-list
ntain Vla
>SD> What's wrong with that?
Missing ')' or better spurious '(' :=)
--
Piet van Oostrum
URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4]
Private email: p...@vanoostrum.org
--
http://mail.python.org/mailman/listinfo/python-list
rom the parent (becoming its own parent) as a gui event.
Oh, I saw that in the parent setter but not in the children setter.
--
Piet van Oostrum
URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4]
Private email: p...@vanoostrum.org
--
http://mail.python.org/mailman/listinfo/python-list
lready do this by default
because they are based on HTTP).
>L> How does it work compared to a Java servlet with a Java applet ?
With a Java applet communicating with a Java servlet you also have the
option of using RMI. For the rest it is similar.
--
Piet van Oostrum
URL: http://pietvanoos
>A> start" is printed, there is sometimes (it vary a lot) several seconds.
>A> How could it be? Why thread is not started instantly? How can I improve
>A> that?
I don't know if it is related to our problem but I guess it is.
It appears that GTK and Python threads
>>>>> "Ciprian Dorin, Craciun" (CDC) wrote:
>CDC> About the compare (a, b, operator.lt) it does the same as a < b,
>CDC> where a and b are lists of numbers.
>>> a=[1, 2, 3]
>>> b=[1, 2, 4]
>>> compare (a, b,
>>>>> Linuxguy123 (L) wrote:
>L> On Sat, 2009-04-25 at 02:00 +0200, Piet van Oostrum wrote:
>>> >>>>> Linuxguy123 (L) wrote:
>>>
>>> >L> Hi guys.
>>> >L> Is there a way to use a python application as the
our original post you
wanted RPC.
--
Piet van Oostrum
URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4]
Private email: p...@vanoostrum.org
--
http://mail.python.org/mailman/listinfo/python-list
he install
>O> location to be here:
>O> /System/Library/Frameworks/Python.framework/
That's a good recipe to ruin your system software.
--
Piet van Oostrum
URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4]
Private email: p...@vanoostrum.org
--
http://mail.python.org/mailman/listinfo/python-list
> be here:
>O> /System/Library/Frameworks/Python.framework/
>O> Do I need to use the "--libdir" flag? Or is that referring to "lib"
>O> not "Library"?
Why do you ask the same question twice, and with different subjects?
This makes answering diffi
urce, parse it and extract the
environment variables from it.
--
Piet van Oostrum
URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4]
Private email: p...@vanoostrum.org
--
http://mail.python.org/mailman/listinfo/python-list
ults:
results = [pool.apply_async(f, a) for a in args]
print [r.get() for r in results]
Now the calls to f are done in parallel, which you can check by putting
a sleep inside f.
--
Piet van Oostrum
URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4]
Private email: p...@vanoostrum.org
--
http://mail.python.org/mailman/listinfo/python-list
n Emacs I get:
UnicodeEncodeError: 'ascii' codec can't encode characters in position
0-1: ordinal not in range(128)
because my Emacs doesn't pass the encoding of its terminal emulation.
However:
python -c '# -*- coding:utf-8 -*-
print len(u"ä")'
will correctly print 1.
--
Piet van Oostrum
URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4]
Private email: p...@vanoostrum.org
--
http://mail.python.org/mailman/listinfo/python-list
301 - 400 of 717 matches
Mail list logo