In a Masters for Data Science and need the help using Python/R mainly.
Please forward background(education, work) teaching experence in stats,
linear algebra, programming (Scikit, Panda, Numpy), timezone, and rates.
--
https://mail.python.org/mailman/listinfo/python-list
Hello everyone,
I googled and googled and can't seem to find the definitive answer: how
to *properly* deinstall egg? Just delete the folder and/or .py and .pyc
files from Lib/site-packages? Would that break anything in Python
installation or not?
Regards,
mk
--
http://mail.pytho
Diez B. Roggisch wrote:
Thanks, Diez.
--
http://mail.python.org/mailman/listinfo/python-list
Hello everyone,
Are there *good* reasons to use uncompressed eggs?
Is there a, say, performance penalty in using compressed eggs?
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
in
this manner (well it's possible that standardoutputstr and/or
standarderrorstr fill up the memory, you get the idea).
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
psaff...@googlemail.com wrote:
On 12 Jan, 15:33, mk wrote:
Better use communicate() method:
Oh yes - it's right there in the documentation. That worked perfectly.
What's also in the docs and I did not pay attention to before:
Note
The data read is buffered in memory, so do no
or very easy
performance optimizations of the small portions of the code! This could
have been a huge gain acquired for little effort!
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
least compiler warning (optionally,
error) for situation where attributes are added to self outside of
__init__. I consider it generally evil and hate to see code like that.
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
's kind of like retrofitting steam engine onto a Mach 2 jetfighter.
Well there's always awk2c..
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
f.func
>>> @MyMethod
def f():
pass
>>> f()
f
Note that function decorator returned None, while class decorator
returned function.
Why the difference in behavior? After all, print_method_name decorator
also returns a function (well it's a new function but
ss instance, let's call it _decor.
2. Then _decor's __call__ method is called with function f as argument,
changing the docstring and returning the changed f object, like f =
_decor(f) .
Am I missing smth important / potentially useful in typical real-world
applications in that picture?
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
found such holy grail?
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
5/203 12342
08-11-19 16:44 0.62 0.47 0.37 5/207 12424
08-11-19 16:45 0.26 0.39 0.35 6/206 12510
08-11-19 16:46 0.66 0.51 0.39 4/203 30135
08-11-19 16:47 0.31 0.43 0.37 5/206 30196
08-11-19 16:48 0.17 0.36 0.35 6/205 30243
08-11-19 16:49 0.62 0.49 0.39 5/206 15559
08-11-19 16:50 0.34 0.43 0.37 7/206 15604
08-11-19 16:51 0.12 0.35 0.35 7/209 15655
08-11-19 16:52 0.52 0.44 0.38 5/202 818
08-11-19 16:53 0.22 0.37 0.36 4/206 912
08-11-19 16:54 0.08 0.30 0.33 5/201 955
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
together
with the app.
Since this topic is interesting for me anyway (i.e. how to transform
wxPython app using py2exe into Windows executable), would someone please
reply on how to do it?
Thanks,
mk
--
http://mail.python.org/mailman/listinfo/python-list
times slower.
Levenshtein distance using linked lists? That's novel. Care to
divulge?
I meant: using linked lists to store words that are compared. I found
using vectors was slow.
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
ting apparently correct version:
import wxversion
wxversion.select('2.8')
I put this in setup.py:
import wxversion
wxversion.select("2.8.9.1")
import wx
..and it worked.
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
wondering if there's anything better out there...
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
t does *m mean in this example and how does it do the magic here?
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
#x27;: '12:50', 'val': 0.17}]
self.assertEqual(valist, valist_ut)
vlextr_ut = [0.11, 0.08, 0.57, 0.21, 0.08, 0.66, 0.32, 0.12,
0.47, 0.17]
vlextr = ma.extrvalues(valist)
self.assertEqual(len(vlextr_ut), len(vlextr))
for (idx, elem) in enumerate(vlextr_ut):
self.assertAlmostEqual(elem, vlextr[idx])
But I was wondering, *should* this test be separated into two unit
tests, one for each function? On the face of it, it looks that's how it
should be done.
This, however, raises the question: what's the order of test execution
in the unittest? And how to pass values between unit tests? Should I
modify 'self' in unit test?
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\mingw32\bin\ld.exe:
cannot find -lgw32c
collect2: ld returned 1 exit status
error: command 'g++' failed with exit status 1
What the heck is lgw32c??
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
_maxy=2009&as_ugroup=%s&as_usubject=&as_uauthors=&safe=off'
qurls = map(fillurlfmt, [ (urlfmt, ggroup, gkw) for gkw in gkeywords])
return qurls
if __name__ == "__main__":
gkeywords = ['rtfm', 'shut']
ggroups = ['comp.lang.python', 'comp.lang.perl']
params = [(ggroup, gkeywords) for ggroup in ggroups]
qurls = map(consqurls, params)
print qurls
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
, 5, 6, 7, 8, 9, 10]
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
>return res
Hmm why should it be more efficient? extend operation should not be very
costly?
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
, res=None):
if res is None:
res = []
for el in x:
if isinstance(el, (tuple, list)):
flatten(el, res)
else:
res.append(el)
return res
Hmm why should it be more efficient? extend operation should not be very
costly?
Regards,
mk
--
http://mail.python.o
n really more costly than above?
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
esults \1\ - \.+?\ of about
\(.+?)\')
gextrsearchresult = extrclosure(resre,1)
gresults = map(gextrsearchresult, gresults)
gresults = map(delcomma, gresults)
for el in gresults:
print el['result'], el['group'], el['keyword']
print
This was inspired by
http://mail.python.org/pipermail/python-list/2002-November/172466.html
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
re most probably right in this; however, my main goal here was
finding 'more Pythonic' way of doing this and learning this way rather
than the practical purpose of flattening deeply nested lists.
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
Michele Simionato wrote:
Looks fine to me. In some situations you may also use hasattr(el,
'__iter__') instead of isinstance(el, list) (it depends if you want to
flatten generic iterables or only lists).
Thanks! Such stuff is what I'm looking for.
Regards,
mk
--
http://
t;. Either list creation
is somewhat costly, or "if var is None" is really cheap.
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
Hi,
I'm trying to consume a SOAP web service using Python. So far I have
found two libraries: SOAPpy and ZSI. Both of them rely on PyXML which
is no longer maintained (and there is no build for 64bit Windows and
the setup.py doesn't seem to know how to build it on Windows). Is
there a live SOAP
On Feb 11, 11:20 am, Robin wrote:
> On Feb 11, 3:33 pm, mk wrote:
>
> > Hi,
>
> > I'm trying to consume aSOAPweb service using Python. So far I have
> > found two libraries: SOAPpy and ZSI. Both of them rely on PyXML which
> > is no longer maintained (a
odec can't encode character u'\u0144' in
position 74: ordinal not in range(128)
..when doing:
for row in rd:
...
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
Hello everyone,
After reading http://www.python.org/dev/peps/pep-0371/ I was under
impression that performance of multiprocessing package is similar to
that of thread / threading. However, to familiarize myself with both
packages I wrote my own test of spawning and returning 100,000 empty
thr
janislaw wrote:
Ah, so there are 100 processes at time. 200secs still don't sound
strange.
I ran the PEP 371 code on my system (Linux) on Python 2.6.1:
Linux SLES (9.156.44.174) [15:18] root ~/tmp/src # ./run_benchmarks.py
empty_func.py
Importing empty_func
Starting tests ...
non_threaded
Christian Heimes wrote:
mk wrote:
Am I doing smth wrong in code below? Or do I have to use
multiprocessing.Pool to get any decent results?
You have missed an important point. A well designed application does
neither create so many threads nor processes.
Except I was not developing "
Jarkko Torppa wrote:
On the PEP371 it says "All benchmarks were run using the following:
Python 2.5.2 compiled on Gentoo Linux (kernel 2.6.18.6)"
Right... I overlooked that. My tests I quoted above were done on SLES
10, kernel 2.6.5.
With python2.5 and pyProcessing-0.52
iTaulu:src torppa$
Hello everyone,
This time I decided to test communication overhead in multithreaded /
multiprocess communication. The results are rather disappointing, that
is, communication overhead seems to be very high. In each of the
following functions, I send 10,000 numbers to the function / 10 threads
Aaron Brady wrote:
snips
def threadsemfun():
sem = threading.Semaphore()
def threadlockfun():
sem = threading.Semaphore()
You used a Semaphore for both lock objects here.
Right... I corrected that (simply changed to threading.Lock() in
threadlockfun) and the result is muc
ethod)?
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
ng linked lists in C++) and Python version was 2.5 times slower.
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
http://www.python.org/dev/peps/pep-0008/
"Function Names
Function names should be lowercase, with words separated by underscores
as necessary to improve readability."
However, this PEP does not recommend any particular style for naming
regular (local) variables.
Personally I like "m
Out of curiosity I decided to make some speed comparisons of the same
algorithm in Python and C++. Moving slices of lists of strings around
seemed like a good test case.
Python code:
def move_slice(list_arg, start, stop, dest):
frag = list_arg[start:stop]
if dest > stop:
Rajanikanth Jammalamadaka wrote:
Try using a list instead of a vector for the C++ version.
Well, it's even slower:
$ time slice4
real0m4.500s
user0m0.015s
sys 0m0.015s
Time of execution of vector version (using reference to a vector):
$ time slice2
real0m2.420s
user0m0
Maric Michaud wrote:
Le Wednesday 09 July 2008 12:35:10 mk, vous avez écrit :
vector move_slice(vector& vec, int start, int stop, int
dest)
I guess the point is to make a vector of referene to string if you don't want
to copy string objects all around but just a word for an add
P.S. Java 1.6 rocks - I wrote equivalent version using ArrayList and it
executed in 0.7s.
--
http://mail.python.org/mailman/listinfo/python-list
Hello,
I'm having terrible problems building C++ extension to Python 2.4 using
SWIG. I'd appreciate if somebody knowledgeable at the subject took a
look at it. swig-1.3.29, g++ (GCC) 4.1.1 20070105 (Red Hat 4.1.1-52).
I used following commands to build C++ extension:
# swig -c++ -python edit
And what's infuriating is that the .o files do contain the necessary symbol:
# grep _Z13edit_distanceRSsS_ *
Binary file edit_distance.o matches
Binary file _edit_distance.so matches
Binary file edit_distance_wrap.o matches
--
http://mail.python.org/mailman/listinfo/python-list
Hello Bas,
Thanks, man! Your recipe worked on Debian system, though not on RedHat,
and I still have no idea why. :-) Anyway, I have it working. Thanks again.
I took your example files and did the following:
changed the #include "edit_distance.h" to #include "edit_distance.c"
in the edit_dist
So I was playing around with properties and wrote this:
class lstr(str):
def __init__(self, initval):
self._s = initval
self._len = len(self._s)
def fget_s(self):
return str(self._s)
def fset_s(self, val):
self._s = val
self._len
However, it appears that somehow this object prints the value of 's'
attribute without me setting any specific methods to do that:
>>> astr = lstr('abcdef')
>>> astr
'abcdef'
>>> astr.swapcase()
'ABCDEF'
Correction: it doesn't really get the value from _s attribute:
>>> astr = lstr('abcd
Hello everyone,
I'm storing functions in a dictionary (this is basically for cooking up
my own fancy schmancy callback scheme, mainly for learning purpose):
>>> def f2(arg):
... return "f2 " + arg
...
>>>
>>> def f1(arg):
... return "f1" + arg
...
>>> a={'1': f1, '2': f2}
>>>
>>> [ x[
Calvin Spealman wrote:
To your actual problem... Why do you wanna do this anyway? If you want
to change the function in the dictionary, why don't you simply define
the functions you'll want to use, and change the one you have bound to
the key in the dictionary when you want to change it? In other
Uwe Schmitt wrote:
Python stores references in dictionaries and does not copy ! (unless
you explicitly use the copy module) !
In your case the entry in the dictionary is a reference to the same
object which f1 references, that is the object at 0xb7f0ba04.
If you now say "f1=...:" then f1 refere
It seems like getter is defined in such way that it passes only 'self':
class FunDict(dict):
def __init__(self):
self.fundict = dict()
def fget(self, fun):
return fundict[fun.func_name]
def fset(self, newfun):
self.fundic
def f2(arg):
return "f2 "+arg
def f1(arg):
return "f1 "+arg
a={"1":"f1","2":"f2"}
print [eval(x[1])(x[0]) for x in a.items()]
def f2(arg):
return "New f2 "+arg
print [eval(x[1])(x[0]) for x in a.items()]
Neat trick, if probably dangerous in some circumstances. Anyway, thanks,
I
I have looked through the application for any unusual or bare try/except
blocks that don’t actually do anything with the except just in case any
of them are causing the issue but can’t seem to see any.
Why not capture exceptions themselves to a log file?
http://aspn.activestate.com/ASPN/Cookbo
Robert Rawlins wrote:
I certainly like that implementation for logging the exceptions, however, at
the moment I don't even know where the exceptions are occurring, or what
type they are, could I still use this method to log any and all exceptions
raised in the application?
Sure.
I'm a little
Gary Herron wrote:
You could remove the object from the list with
del myList[i]
if you knew i. HOWEVER, don't do that while looping through the list!
Changing a list's length will interact badly with the for loop's
indexing through the list, causing the loop to mis the element following
the
http://linux.byexamples.com/archives/365/python-convey-the-exception-traceba
ck-into-log-file/
if __name__=="__main__":
try:
main()
except:
print "Trigger Exception, traceback info forward to log file."
traceback.print_exc(file=open("errlog.txt","a"))
Ok, Just to add a little interest, when I comment out the configuration line
for my logging, like so:
#logging.config.fileConfig("/myapp/configuration/logging.conf")
It appears to throw the exceptions as normal :-) :-s
To tell the truth I have never used logging module extensively, so I'm
Hello,
I'm trying to learn how with statement can be used to avoid writing:
prepare()
try:
something_that_can_raise_SomeException()
except SomeException, err:
deal_with_SomeException
finally:
tear_it_down()
Verbose, not very readable. OK, "with" to the rescue?
Let's tak
from __future__ import with_statement
class ExceptionManager(object):
def __enter__(self):
pass
def __exit__(self,exc_type,exc_value,tb):
if exc_type == IOError:
print 'IOError',exc_value[1]
return True # suppress it
wi
Grant Edwards wrote:
Using punch-cards and paper-tape. Real programmers can edit
their programs with a pointy stick and some home-made
sticky-tape.
Wrong! Real programmers can program using only Touring machine (and
something having to do with post for some reason). I'm sure our
brilliant O
http://llvm.org/
This project has gained some publicity. There's IronPython, right, so
has anybody thought about implementing Python using LLVM as backend, as
it seems not out of question at all?
--
http://mail.python.org/mailman/listinfo/python-list
Who cares what language a language is written in as long as you can be
productive - which you certainly can be in Python.
Seriously, though, would there be any advantage in re-implementing
Python in e.g. C++?
Not that current implementation is bad, anything but, but if you're not
careful,
Unfortunately, there seems no such resolution existed. So maybe I
have to give up some requirements.
Why not PYRO? Note: I haven't used it.
--
http://mail.python.org/mailman/listinfo/python-list
Fredrik Lundh wrote:
mk wrote:
This project has gained some publicity. There's IronPython, right, so
has anybody thought about implementing Python using LLVM as backend,
as it seems not out of question at all?
you mean like:
http://llvm.org/ProjectsWithLLVM/#pypy
?
No, I don
Jie wrote:
Hi all,
i'm having trouble executing os.system('source .bashrc') command
within python, it always says that source not found and stuff. Any
clue?
It _might_ be that the shell it fires up is /bin/sh and this in turn is
not bash.
Anyway, it's better to use subprocess / Popen for th
Marc 'BlackJack' Rintsch wrote:
An operation that most people avoid because of the penalty of "shifting
down" all elements after the deleted one. Pythonistas tend to build new
lists without unwanted elements instead.
Which is exactly what I have done with my big lxml.etree, from which I
need
Actually, all of the compilers I'm familiar with (gcc and a
handful of cross compilers for various microprocessors)
translate from high-level languages (e.g. C, C++) into
assembly, which is then assembled into relocatable object
files, which are then linked/loaded to produce machine
language.
Do
Hello everyone,
I try to set two properties, "value" and "square" in the following code,
and arrange it in such way that setting one property also sets another
one and vice versa. But the code seems to get Python into infinite loop:
>>> import math
>>> class Squared2(object):
def __i
Thanks to everyone for answers..
*but*, if you want to add more logic in the setters, you could want to add two
extra methods :
def _setsquare(self, v) :
# some extra logic here
self._square = s
def fsetsquare(self,s):
self
Hello,
Does anyone knows how can I
--
http://mail.python.org/mailman/listinfo/python-list
Hello,
Does anyone knows how can I
--
http://mail.python.org/mailman/listinfo/python-list
Hello,
Does anyone knows how to use the Excel sort function in python?
--
http://mail.python.org/mailman/listinfo/python-list
u do it like this:
from win32com.client import Dispatch
xlApp = Dispatch("Excel.Application")
xlApp.Workbooks.Open("D:\python\sortme.csv")
xlApp.Range("A1:C100").Sort(Key1=xlApp.Range("B1"), Order1=2)
xlApp.ActiveWorkbook.Close(SaveChanges=1)
xlApp.Quit()
del xlApp
--
http://mail.python.org/mail
idea how to test this. I've done profiling which
indicated nothing, basically all function calls except time.sleep take
negligible time.
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
I'm stumped; I read somewhere that one would have to modify Thread.run()
method but I have never modified Python methods nor would I really
want to do it.
Is there any way to start cProfile on each thread and then combine the
stats?
Regards,
mk
--
http://mail.python.org/mailman/lis
r to the above), it's not burning it in the
individual worker threads - so where the heck it is burning this CPU
time? bc 'top' shows heavy CPU load during most of the time of the
program run.
help...
regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
t comprehension preserves order:
hostips_limited = [ h for h in hostips if h in thread_results ]
Empirically speaking it seems to work (I tested it on real ips), but
please correct me if that's wrong.
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
mk wrote:
Hello everyone,
I have two lists of IP addresses:
hostips = [ 'a', 'b', 'c', 'd', 'e' ]
thread_results = [ 'd', 'b', 'c' ]
I need to sort thread_results in the same order as hostips.
P.S. One clari
Hello,
I have trouble building Python static binary (for use with 'freeze.py',
as frozen Python programs do not include dynamically linked libs). Anybody?
./configure --disable-shared --with-ldflags=-ldl
And yet after compiling the resulting binary is linked with following
dynamic libraries:
P.S.
If I add -static to LDFLAGS in Makefile, I get this:
gcc -pthread -static -Xlinker -export-dynamic -o python \
Modules/python.o \
libpython2.6.a -lpthread -ldl -lutil
-L/usr/local/ssl/lib -lssl -lcrypto -lm
libpython2.6.a(dynload_shlib.o
amiko/pkey.py", line
28, in
from Crypto.Cipher import DES3
ImportError: cannot import name DES3
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
\n', '\n']
['9.156.44.227', '9.156.46.34']
Are there two '\n' strings in the interpreter's memory or smth so the
identity check "s is not '\n'" does not work as expected?
This is weird. I expected that at all times there is
Hello everyone,
I wrote run-of-the-mill program for concurrent execution of ssh command
over a large number of hosts. (someone may ask why reinvent the wheel
when there's pssh and shmux around -- I'm not happy with working details
and lack of some options in either program)
The program has a
ait, or a
function name to be executed, as arguments to the Timer.
I'm newbie at threading, so I'm actually asking: should not method like
stop() be surrounded with acquire() and release() of some threading.lock?
I mean, is this safe to update running thread's data from the main
Hello everyone,
Since I'm not happy with shmux or pssh, I wrote my own "concurrent ssh"
program for parallel execution of SSH commands on multiple hosts. Before
I release program to the wild, I would like to hear (constructive)
comments on what may be wrong with the program and/or how to fix i
open.communicate() says "communicate() returns a tuple (stdoutdata,
stderrdata)" but doesn't say what is the class of stdoutdata and
stderrdata (a file object to read? a string?).
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
the last group. Is there any way to
capture all groups with repeat following it, i.e. (...)+ or (...)* ?
Even better would be:
('tmp', 'spam', 'eggs')
Yes, I know about re.split:
>>> re.split( r'(?:\w:)?[/\\]', r'c:/tmp/spam\\eggs/'
r:" type of statements in cpython implementation?
regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
compiler or implementation internals and so I have no
idea what bytecode "JUMP_IF_FALSE" is actually doing.
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
the
module perhaps gets unloaded and as result "paramiko" label leads to
None, which obviously has no attribute BadAuthenticationType.
However, even though this is surrounded by try .. except AttributeError
block, it evidently isn't catch. How to catch that exception? Or at
Hello,
Is there an easy way to get an editing (readline) in Python that would
contain string for editing and would not just be empty?
I googled but found nothing.
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
Peter Otten wrote:
mk wrote:
Is there an easy way to get an editing (readline) in Python that would
contain string for editing and would not just be empty?
http://mail.python.org/pipermail/python-list/2009-June/1209309.html
Peter
Thanks a lot! Just what I needed.
Regards,
mk
--
http
The application will display (elaborate) financial charts.
Pygame? Smth else?
dotnet?
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
Phlip wrote:
mk wrote:
The application will display (elaborate) financial charts.
Pygame? Smth else?
Back in the day it was Python BLT.
Are you on the Web or the Desktop?
Desktop, really (there should be some nominal web interface but the main
application will be desktop)
Regards,
mk
Steve Holden wrote:
Jeez, Steve, you're beginning to sound like some kind of fallacy
zealot... ;)
Death to all those who confuse agumentum ad populum with argumentum ad
verecundiam!!!
Yeah, what did the zealots ever do for us?
They produced Python?
.
.
.
Oh Python! Shut up!
--
http://
if isinstance(cmd, str):
self.cmd = cmd.replace(r'${ADDR}',ip)
else:
self.cmd = cmd
or
self.cmd = cmd
if isinstance(cmd, str):
self.cmd = cmd.replace(r'${ADDR}',ip)
--
http://mail.python.org/mailman/listinfo/python-list
that under some circumstances cmd is not string. What then?
I know that isinstance is typically not recommended, but I don't see
better solution here.
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
1 - 100 of 214 matches
Mail list logo