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
)
os.chdir(globalpath)
os.umask(0)
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
nd doesn't exclude MIT/Apache license for legal reasons?
(this is obviously orthogonal to a technical question why static linking
should be used sparringly if at all)
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
s but there appear only methods of loading compiled
Python (bytecode) modules.
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
nd it very readable.
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
as experience with them?
Now, I do now about NLTK and Python bindings to UIMA. The thing is, I do
not know if those are good for the above task. If somebody has
experience with those or other and would be able to say if they're good
for this, please post.
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
'], ['python'], ['list'], ['isnt',
'tins'], ['stop', 'post']]
However, when I change the last line to:
print map(list, map(itemgetter(1), gb))
It stops working:
[[], [], [], [], [], [], [], [], [], [], [], [], [], [], [], ['post']]
Why? I was under impression that the only difference between map and
imap is that imap returns iterator allowing to produce a list, while map
returns equivalent list?
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
Rolando Espinoza La Fuente wrote:
Doesn't have side effects not knowing that False/True are ints?
It does, in fact I was wondering why my iterator didn't work until I
figured issubclass(bool, int) is true.
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
ery much.
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
lbolla wrote:
It looks like Perl ;-)
A positive proof that you can write perl code in Python. I, for
instance, have had my brain warped by C and tend to write C-like code in
Python. That's only half a joke, sadly. I'm trying to change my habits
but it's hard.
Regard
>>> isinstance(False, int)
True
>>>
>>> isinstance(True, int)
True
Huh?
>>>
>>> issubclass(bool, int)
True
Huh?!
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
nn wrote:
Oh my! You could have at least used some "if else" to make it a little
bit easier on the eyes :-)
That's my entry into """'Obfuscated' "Python" '"''code''"'
'"contest"'""" and I'm proud of it. ;-)
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
st invented a cute ;-) two-liner using list comprehensions:
# alist = list above
tmp, dk = [], {}
[(x.startswith('VLAN') and (dk.setdefault(x,[]) or tmp.append(x))) or
(not x.startswith('VLAN') and dk[tmp[-1]].append(x))for x in alist
if x != 'Interface']
No need to use a nuke like itertools to kill a fly. ;-)
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
some project.
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
({k:interm[k]})
return finlist
if __name__ == "__main__":
intermediate = makeintermdict(elems)
print intermediate
finlist = makelist(intermediate)
print 'final', finlist
{'4068': ['Gi9/6'], '4069': ['Gi9/6'], '4065': ['Gi9/6', 'Po2', 'Po3',
'Po306']}
final [{'4068': ['Gi9/6']}, {'4069': ['Gi9/6']}, {'4065': ['Gi9/6',
'Po2', 'Po3', 'Po306']}]
I hope this is not your homework. :-)
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
ss that in a purely imaginary example, you could also combine two
databases? Say, a tweet bigtable db contains tweet, but with column of
classical customer_id key that is also a key in traditional RDBMS
referencing particular customer?
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
ng some query in "low-level" SQL, as I
have done a few times, it's still easy to make SQLAlchemy slurp the
result into objects provided you ensure there are all of the necessary
columns in the query result)
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
languages for
OODBMS. Sadly, I have not had time to get & read those sources.
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
Bruno Desthuilliers wrote:
mk a écrit :
Obviously, don't try this on low-memory machine:
a={}
for i in range(1000):
Note that in Python 2, this will build a list of 1000 int objects.
You may want to use xrange instead...
Huh? I was under impression that some time after 2.0
inted
out, the *type* of bultins is hashable.
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
a lot: allocating
key in a dict, then sorting dict's keys, then iterating over keys and
accessing dict value.
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
ey] = line
sortedlines = []
keys = linedict.keys()
keys.sort()
for key in keys:
sortedlines.append(linedict[key])
return sortedlines
if __name__ == '__main__':
sortit('testfile.txt')
MRAB's solution is obviously better, provided you know ab
ext day it had brought up
about two thirds of the initial VM loader screen ...
You tell these young kids, and they just don't believe you!
For the uncouth yobs, err, culturally-challenged:
http://www.youtube.com/watch?v=Xe1a1wHxTyo
(Four Yorkshiremen)
Regards,
mk
--
http://mail.pyt
Arnaud Delobelle wrote:
mk writes:
[...]
hashable
..
All of Python’s immutable built-in objects are hashable, while no
mutable containers (such as lists or dictionaries) are.
Well ok, hashable they're not; but apparently at least dict and list
have id()?
lists and dicts are not has
joins apparently are at least twice as expensive as simple
selects without joins, on a small dataset. Not a drastic increase in
cost, but smth definitely shows.
It would be interesting to see what happens when row numbers increase to
large numbers, but I have no such data.
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
Have you looked in a file easy-install.pth in site-packages? In my
experience it's enough to delete the line for package from there and
delete package's egg or directory.
I agree that this is kind of backward, though.
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
do not know if it's true,
it's because Gates fancied using / for options switch instead of -, and
to hell with established practice.
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
g the first table, with stored procedures to ensure you still have
correct data in all tables.
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
ay be
"one obvious way to do it" in a very, very narrow context, but when
contexts widen, like, say: "what is web framework I should choose?" the
answers diverge, because answer has to be variation of "it depends on
your situation".
Whether RSON is really an
t)
135709728
>>> id(dict)
135714560
>>> id(dict)
135714560
>>> c=dict
>>> id(c)
135714560
2. Drawbacks?
3. Better/fancier way to do this?
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
But according
to top RSS of the python process is 300MB. ps auxw says the same thing
(more or less).
Why the 50% overhead? (and I would swear that a couple of times RSS
according to top grew to 800MB).
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
*10
...
>>> sys.getsizeof(a)
25165960
So that's what, 25 MB?
Although I have to note that TEMPORARY ram usage in Python process on my
machine did go up to 113MB.
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
dred lines but took 5 minutes to compile; "VAX" was
theoretically multitasking, but when more than 3 people were trying to
do smth on it simultaneously, it was basically seizing up.
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
ase of complicated object
hierarchies it supposedly generates a lot of JOINs and that supposedly
kills DB performance.
So there *may* be some evidence that joins are indeed bad in practice.
If someone has smth specific/interesting on the subject, please post.
Regards,
mk
--
http://mail.python.or
eek"ing you could write a function that could e.g. acquire a lock,
do a copy of the queue, release the lock, and return the copy to the
object wanting to examine the queue.
I have used this approach (although with a list, not a dictionary -- I
haven't had the need to do extensive sea
ching scarce resources thin"
either: abominations completely unfit to live waste little in the way of
resources, and we learn a deal off them too.
There are demonstrable benefits to this too: I for one am happy that
ReST is available for me and I don't have to learn a behemoth s
to do the "right thing" may indeed get one in trouble in
case of deadlock caused by a bug in one's own program.
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
it sounds like Python already does what you want. You
don't need to do anything special.
Oh, thanks!
Hmm it's different than dealing with packages I guess -- IIRC, in
packages only code in package's __init__.py was executed?
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
Where do you take class Email from? There's no info in your mail on this.
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
ey
create 'subprocess' namespace in a class or instance, respectively.
Is there anyway to make it a global import?
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
Tobiah wrote:
Now that I use python, this is the amount of time
per day that I spend adding forgotten semicolons while
debugging other languages.
My objects are flat and I don't know who's Guido.
I blame it all on Python.
How about a PEP "Let's make Python look lik
n AND programmer 1 knows what params 1-7
do, programmer 2 knows what params 8-15 do and nobody knows what params
16-20 do.
Seriously.
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
al transactions, you have to choose InnoDB table type
but then you lose much of the performance. Etc.
No, if you have a choice, avoid MySQL and go for PGSQL. It's fantastic,
if (necessarily) complex.
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
if someone here did
perhaps they will shed some light on it?
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
to change.
There's also ultra-cool-and-modern Tokyo Cabinet key:value store with
Python bindings:
http://pypi.python.org/pypi/pytc/
I didn't test it, though.
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
l have to be worked out, but the project didn't
get to that stage yet, it's all still in planning stages. I just wanted
to have this one part (password generation) researched before I get to
other stages so I don't have to implement this later in haste and do
smth wrong.
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
same number of occurences,
you can do
return sorted(qips) == sorted(oldqips)
assuming that all elements in the lists are comparable.
Thanks!
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
On 2010-02-25 02:07, Steven D'Aprano wrote:
On Wed, 24 Feb 2010 18:23:17 +0100, mk wrote:
Anyway, the passwords for authorized users will be copied and pasted
from email into in the application GUI which will remember it for them,
so they will not have to remember and type them in.
On 2010-02-25 03:04, Gabriel Genellina wrote:
Also try:
import antigravity
Is this Py3 egg? My 2.6 doesn't seem to get it.
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
long as the values are the same.
I was wondering if there's a better / shorter / faster way to do this --
not necessarily in the same variant, e.g. variant where order of two
lists matters would be interesting as well.
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
n't trust the PRNG.
I just posted a comparison with calculating std deviations for various
methods - using os.urandom, SystemRandom.choice with seeding and without
seeding.
They all seem to have slightly different distributions.
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
On 2010-02-24 20:19, Robert Kern wrote:
On 2010-02-24 13:09 PM, mk wrote:
On 2010-02-24 20:01, Robert Kern wrote:
I will repeat my advice to just use random.SystemRandom.choice() instead
of trying to interpret the bytes from /dev/urandom directly.
Oh I hear you -- for production use I would
f 3795
t 3784
p 3765
j 3730
i 3704
Better, although still not perfect.
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
Get a decent editor, like PyScripter, and press Ctrl-' (toggle comment).
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
oblem itself: why is the damn
distribution not uniform?
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
f the
world) were computed the same way (random hexdigit and just mod it when
it's too large) leading to a high probability that your first digit was
a 1 :)
Schadenfreude is deriving joy from others' misfortunes; what is the
German word, if any, for deriving solace from others' misfortunes? ;-)
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
ffort (on and off) with programming in
Python is under a year.
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
ou will have to add those extensions in
"hook" script.
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
Interesting, and I was thinking that UK sample was big enough for such
things not to matter.
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
x27;'.join([chr(ord('a')+ord(c)%26) for c in f.read(n)])
print randomword(nletters)
Aw shucks when will I learn to do the stuff in 3 lines well instead of
20, poorly. :-/
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
ughtful and may help you understand the relevant issues.
Thanks. But I would also be grateful for indicating what is wrong/ugly
in my code.
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
Hello everyone,
Is there smth like AKKA in Python?
http://akkasource.org/
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
Of course. Multithreading also fails miserably if the threads all try
to call exec() or the equivalent.
It works fine if you use os.fork().
What about just using subprocess module to run system commands in worker
threads? Is this likely to have problems?
Regards,
mk
--
http://mail.python.o
sure about your field of application (never done anything like
that), but I found pyparsing highly usable.
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
based on
(percentage of job offers with the keyword "php" in them).
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
ss
time by using advanced programming langauges. Frankly, I have yet to
encounter a problem for which either a sizable Python extension or
bindings to a popular library wouldn't exist. This in itself is a
hallmark of a language being "enough of mainstream to actually matter
generated this
way be considered truly random? (I abstract from not-quite-perfect
nature of /dev/urandom at the moment; I can always switch to /dev/random
which is better)
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
its old self (so quite likely it was
the new, nostatget, descriptor).
But Bruno pointed out that I need instancemethod for that, not plain
function.
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
Steven D'Aprano wrote:
On Thu, 18 Feb 2010 18:28:44 +0100, mk wrote:
nostat.__orig_get__ = nostat.__get__
I should point out that leading-and-trailing-double-underscore names are
reserved for use by the language.
Right... I completely missed that. I will try to change the habi
been replaced, but if so, why
nostatget doesn't get called?
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
Bruno Desthuilliers wrote:
I think you broke something somewhere. Assuming you're using Python 2.x
(>= 2.3 IIRC), my above code works.
ARGH! Forgot the "delayed staticmethod" line -- in effect I called
staticmethod twice:
@staticmethod
def print_internal_date(filename):
f =
Bruno Desthuilliers wrote:
class Foo4(object):
""" working solution 2 : use a lambda """
@staticmethod
def bar(baaz):
print baaz
tagada = {'bar': lambda x : Foo4.bar(x)}
def test(self, baaz):
self.tagada['bar'](baaz)
Huh? How does this one work? After al
t object in the argument's list
and returns the result of calling the wrapped function object.
Aha! So that's the mechanism that makes self magically appear in an
argument list! I always wondered how it worked. !!THANKS!!
My 2 cents...
Well, Bruno -- that was more like $200!
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
Bruno Desthuilliers wrote:
I think I know where the problem is: what resides in tagdata is a
static method 'wrapper', not the function itself, according to:
Indeed. Sorry, I'm afraid I gave you bad advice wrt/ using a
staticmethod here - I should know better :( (well, OTHO staticmethods
are n
Hello everyone,
Disclaimer: I'm doing this mainly for learning purposes, to feel what
it's good for.
I'm trying to get print_internal_date become a static method AND to
refer to it in a class attribute 'tagdata' dict.
class PYFileInfo(FileInfo):
'python file properties'
@staticmeth
Stephen Hansen wrote:
Or just leave it as a top level function where it was perfectly happy to
live :)
Yes. This is probably the sanest solution anyway, because probably
having many such functions to use, packing them into smth like
package.utils anyway is a good idea. I'm trying mainly to le
be called __print_internal_date really. ;-)
I wonder if I'm not trying to make Python things it shouldn't be doing,
but it's the problem at hand that is leading me into this conundrum: all
other functions for tagdata use single arguments. I should probably code
around that anyway..
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
>>> class Person(object):
... pass
...
>>> class Friendly(object):
... def hello(self):
... print 'hello'
...
>>>
>>> Person.__bases__ += (Friendly,)
Traceback (most recent call last):
File "", line 1, in
TypeError: Cannot create a consistent method resolution
order (MRO) fo
iously, however, suppose tagdata or smth like this
is really large? It would make sense to make it class attribute and not
instance attribute. So I'm trying to work out if there's a way to do it.
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
into detail here:
http://www.artima.com/weblogs/viewpost.jsp?thread=246488
Thanks Kurt, I will certainly look into that!
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
Bruno Desthuilliers wrote:
mk a écrit :
P.S. Method resolution order in Python makes me want to kill small
kittens.
mro is only a "problem" when using MI.
Oh sure! And I have the impression that multiple inheritance is not used
all that often. What (some) Python code I'
to kill small kittens.
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
_(self, arg)
D.__init__(self, arg)
def some(self):
self.met()
def overriden(self):
print "I'm really E's method"
e = E(10)
print 'MRO:', ' '.join([c.__name__ for c in E.__mro__])
e.some()
e.calling_overriden()
Result:
...
W. eWatson wrote:
P.S. I didn't really use PyInstaller on Windows, though -- just on
Linux, where it works beautifully.
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
ktop. What's up?
I've had these messages (key) occur on other Python installs as I
transition to Win7. So far no problem.
You may want to consider dumping the thing and going for PyInstaller,
which in my experience is better and has friendly developer community
behind i
I found this:
http://effbot.org/zone/metaclass-plugins.htm
(Although I'm not entirely sure this is the best approach for the web app)
How would you approach designing such architecture using features
available in Python (and some major web framework, like Pylons or Django)?
Regar
d in a function.
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
g 'helpful' in a bad way!
And the default encoding is coded in such way so it cannot be changed in
sitecustomize (without code modification, that is).
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
Aahz wrote:
You can also use os._exit().
Yes! It works cleanly! Thanks a million!
OTOH, if I use sys.exit(), it's just hanging there.
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
Aahz wrote:
You can also use os._exit().
Thanks!
--
http://mail.python.org/mailman/listinfo/python-list
Same as me, except I get lots of exceptions in threads if I shut down
with sys.exit. SIGTERM somehow gets around this problem.
I'll try os._exit.
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
. Thanks!
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
Paul Rubin wrote:
mk writes:
Um... run your code in a debugger.
..except the code in question is multithreaded and pdb is no good for
that, and last time I checked, yappi was broken.
Try winpdb.org.
This is a treasure! In minutes I've had this attached to remote process
and debu
Stephen Hansen wrote:
the uncommon, the exceptional, case. If one could somehow turn off
exceptions, you can't even do a for loop: every for loop would become
infinite-- exceptions are how Python signals the end of an iterator.
Think about that, *every* for loop in Python suddenly breaks.
Hm
C)
paramiko uses close to 100% of CPU when negotiating with such broken or
unresponsive hosts.
For my reasons, I need to get this fixed.
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
tance*? That is, how do I know who's the caller?
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
se" statement at the start of that handler.
This will re-raise the same exception, which will presumably not be
caught a second time?
I don't know where the handler is, that is precisely a problem. I'm
trying to locate that handler.
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
t call last):
File "", line 1, in
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc4 in position 0:
ordinal not in range(128)
There's logic to this, although it makes my brain want to explode. :-)
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
rying to obtain.
Anybody knows of such possibility?
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
ith conditions/events/whatever and the thread
cooperating and exiting on its own.
I will probably have to get the library author look at this.
Regards,
mk
--
http://mail.python.org/mailman/listinfo/python-list
1 - 100 of 214 matches
Mail list logo