On Tue, Nov 10, 2009 at 7:56 AM, Marco Mariani ma...@sferacarta.com wrote:
Grant Edwards wrote:
MacOS applications made the same mistake on the 68K.
And and awful lot of the Amiga software, with the same 24/32 bit CPU.
I did it too, every pointer came with 8 free bits so why not use
On Thu, Nov 12, 2009 at 12:06 PM, Russ P. russ.paie...@gmail.com wrote:
I have a Python program that runs too slow for some inputs. I would
like to speed it up without rewriting any code. Psyco seemed like
exactly what I need, until I saw that it only works on a 32-bit
architecture. I work in
I'd write it as:
s = sorted(d.iteritems(), key=lambda i: i[1][2])
If using python 3, it should be d.items() instead of d.iteritems().
d.iteritems() is a generator yielding tuples of (key, value) from
the dictionary 'd'.
lambda i: i[1][2] is the same as:
def sort_(i):
return i[1][2]
but
A 32 bit app can only use 4 GB of memory itself (regardless of the amount of
system ram), the OS claims some of this for the system, dlls occupy some of
it, etc. As such, the app can only really use a smaller subset (generally
between 2 to 3 GB, depending upon the app and the OS).
Chris
On Fri,
On Fri, Mar 5, 2010 at 5:22 PM, Pete Emerson pemer...@gmail.com wrote:
I've been wrestling with dicts. I hope at the very least what I
discovered helps someone else out, but I'm interested in hearing from
more learned python users.
I found out that adding a two dimensional element without
You likely need to install the Microsoft Visual C++ 2008 SP1 Redistributable
Package on the target machine. If you search Google for this, you should
find it (make sure to grab the correct version of x86 or x64 depending upon
the Python version).
Chris
On Mon, Aug 31, 2009 at 12:43 PM, MikeC
Lets look at what is happening on a few of the lines here:
First:
from coin_toss import coin_toss
imports the module coin_toss and sets the local variable coin_toss to the
value of coin_toss in the module coin_toss.
Second:
coin_toss = coin_toss()
calls the function bound to the name
-Mail's reply all). In general, unless the reply is
off-topic or personal, it should be replied to on-list. This allows more
people to both see the answer and to help further explain the answer.
--- On *Mon, 9/28/09, Chris Kaynor ckay...@zindagigames.com* wrote:
From: Chris Kaynor ckay
If I'm reading the indentation correctly, the else is applying to the for
loop, not the if statement.
When used in this way, the else occurs only if the for loop exits due to
completion (aka, the for loop does not exit due to a break or return
statement).
I would expect the output from that
On Fri, Oct 9, 2009 at 10:10 AM, Stephen Hansen apt.shan...@gmail.comwrote:
On Fri, Oct 9, 2009 at 10:02 AM, Victor Subervi
victorsube...@gmail.comwrote:
Hi;
I have the following code:
elif table[0] == 't': # This is a store subtype table
bits = string.split(table, '0')
Chris
On Mon, Oct 12, 2009 at 11:33 AM, Victor Subervi victorsube...@gmail.comwrote:
Hi;
I have the following code:
for row in data:
i += 1
total = 0
In the above line, you're setting total to 0 each time the loop runs.
quantity = form.getfirst('order_' +
On Mon, Jun 28, 2010 at 1:13 PM, Emile van Sebille em...@fenx.com wrote:
On 6/28/2010 12:02 PM Benjamin Kaplan said...
Just to save the OP some trouble later on: this optimization is done
for most of the __*__ methods. Overriding __add__ on an instance won't
change the behavior of a + b.
On Mon, Jul 12, 2010 at 7:14 PM, Paul Rubin no.em...@nospam.invalid wrote:
Ian Kelly ian.g.ke...@gmail.com writes:
I don't think it's any more egregious than automatic conversions of
mixed-type expressions, such as 3 + 4.5.
That could also be explicit: float(3) + 4.5, or 3 + int(4.5).
Chris
On Tue, Mar 30, 2010 at 11:14 AM, John Nagle na...@animats.com wrote:
aditya wrote:
On Mar 30, 10:49 am, Raymond Hettinger pyt...@rcn.com wrote:
On Mar 30, 8:13 am, aditya bluemangrou...@gmail.com wrote:
To get the decimal representation of a binary number, I can just do
this:
There was a G-mail invasion earlier today that allowed e-mails to be sent
from any g-mail account without the owner's permission.
Chris
On Tue, Apr 20, 2010 at 3:06 PM, Nick Gaens m...@nickgaens.com wrote:
Please someone remove this address from the lists, because of spamming..
--
Nick
I am implemented a custom set-like type which interacts with some
third-party software when retrieving and mutating the set, and have derived
my custom type off of collections.MutableSet, however I have noticed that
some of the magic methods supported by the built-in set do not fully
function with
Okay, thats what I was looking for, thanks.
In my case, I'll just implement the (needed) reflected operators in my
class.
Chris
On Wed, Jan 19, 2011 at 10:02 PM, Daniel Urban urban.d...@gmail.com wrote:
On Thu, Jan 20, 2011 at 01:51, Chris Kaynor ckay...@zindagigames.com
wrote:
I am
On Tue, Feb 22, 2011 at 3:44 PM, Rita rmorgan...@gmail.com wrote:
I have a process like this,
def run(cmd):
#cmd=a process which writes a lot of data. Binary/ASCII data
p=subprocess.Popen(cmd,stdout=subprocess.PIPE)
I would like to get cmd's return code so I am doing this,
def
On Mon, Mar 7, 2011 at 8:38 AM, Rogerio Luz rogeriosantos...@gmail.comwrote:
Hi All
I'd like to pickle an object instance with all values. So I
instanciate myClass and set some values including a list with more
values (in the __init__), then dump to file. I realized that the
pickled object
a.lista
['default', 1, 2, 3, 4, 5, 6, 7, 8, 9]
a = MyClass()
print a.lista
['default', 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 6, 7, 8, 9]
To get around this, you'd need to copy the list (see the copy module).
On Mon, Mar 7, 2011 at 1:51 PM, Chris Kaynor ckay...@zindagigames.comwrote:
On Mon
This list is for development OF Python, not for development in python. For
that reason, I will redirect this to python-list as well. My actual answer
is below.
On Thu, Oct 3, 2013 at 6:45 AM, Igor Vasilyev igor.vasil...@oracle.com
wrote:
Hi.
Example test.py:
class A():
def
On Tue, Oct 22, 2013 at 9:40 AM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
On Tue, 22 Oct 2013 15:39:42 +, Grant Edwards wrote:
No, I was thinking of an array. Arrays aren't automatically initialised
in C.
If they are static or global, then _yes_they_are_. They
On Tue, Oct 22, 2013 at 10:23 AM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
On Tue, 22 Oct 2013 16:53:07 +, Frank Miles wrote:
[snip C code]
What you're missing is that arr[] is an automatic variable. Put a
static in front of it, or move it outside the function (to
On Mon, Sep 24, 2012 at 2:49 PM, Dave Angel d...@davea.name wrote:
And what approach would you use for positioning relative to
end-of-file? That's currently done with an optional second parameter to
seek() method.
I'm not advocating for or against the idea, but that could be handled
the
On Mon, Sep 24, 2012 at 3:37 PM, Ian Kelly ian.g.ke...@gmail.com wrote:
On Mon, Sep 24, 2012 at 4:14 PM, Chris Angelico ros...@gmail.com wrote:
file.pos = 42 # Okay, you're at position 42
file.pos -= 10 # That should put you at position 32
foo = file.pos # Presumably foo is the integer 32
On Mon, Oct 8, 2012 at 12:28 PM, mooremath...@gmail.com wrote:
What's the best way to accomplish this? Am I over-complicating it? My
gut feeling is there is a better way than the following:
import itertools
x = [1, 2, 3]
y = list(itertools.chain.from_iterable(('insertme', x[i]) for i
On Thu, Oct 18, 2012 at 9:47 AM, Dave Angel d...@davea.name wrote:
On 10/18/2012 12:26 PM, Chris Angelico wrote:
On Fri, Oct 19, 2012 at 3:16 AM, Evan Driscoll drisc...@cs.wisc.edu
wrote:
Python isn't as bad as C++ though (my main other language), where
80 characters can go by
On Fri, Oct 19, 2012 at 12:03 PM, Pradipto Banerjee
pradipto.baner...@adainvestments.com wrote:
Thanks, I tried that. Still got MemoryError, but at least this time python
tried to use the physical memory. What I noticed is that before it gave me
the error it used up to 1.5GB (of the 2.23 GB
On Mon, Oct 29, 2012 at 3:30 PM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
On Mon, 29 Oct 2012 17:05:07 +, andrea crotti wrote:
I meant how do I create new immutables classes myself, I guess that's
possible writing C extensions but I don't see in pure Python..
Well, you
On Mon, Oct 29, 2012 at 11:00 AM, Andrew Robinson
andr...@r3dsolutions.com wrote:
Let's look at the source code rather than the web notes -- the source must
be the true answer anyhow.
I downloaded the source code for python 3.3.0, as the tbz;
In the directory Python-3.3.0/Python, look at
One option would be using a hash. Python's built-in hash, a 32-bit
CRC, 128-bit MD5, 256-bit SHA or one of the many others that exist,
depending on the needs. Higher bit counts will reduce the odds of
accidental collisions; cryptographically secure ones if outside
attacks matter. In such a case,
On Thu, Nov 15, 2012 at 8:04 AM, Kevin Gullikson
kevin.gullik...@gmail.com wrote:
Hi all,
I am trying to make a dictionary of functions, where each entry in the
dictionary is the same function with a few of the parameters set to specific
parameters. My actual use is pretty complicated, but I
On Mon, Dec 3, 2012 at 11:58 AM, subhabangal...@gmail.com wrote:
Dear Group,
I have a tuple of list as,
tup_list=[(1,2), (3,4)]
Now if I want to covert as a simple list,
list=[1,2,3,4]
how may I do that?
If any one can kindly suggest? Googling didn't help much.
If you know they are
On Wed, Dec 5, 2012 at 10:50 AM, Olivier Scalbert
olivier.scalb...@algosyn.com wrote:
Hi all !
I have a problem that is not easy to explained, so I have tried to reduce
it a lot.
We are using a framework, that we can not modify.
in framework.py:
def do(something):
'''
Here we
On Wed, Dec 5, 2012 at 12:41 PM, Terry Reedy tjre...@udel.edu wrote:
On 12/5/2012 1:24 PM, Bruno Dupuis wrote:
On Wed, Dec 05, 2012 at 10:59:26AM -0700, Ian Kelly wrote:
I think this should even be considered a bug, not just a missing
optimization. Consider:
This is definitely a bug
Chris
On Wed, Dec 19, 2012 at 7:24 AM, loïc Lauréote laureote-l...@hotmail.frwrote:
Thank for your answer,
I found something allowing to avoid loops.
I use operator overloading.
import math
class Vector:
def __init__(self, x=0, y=0):
self.x=x
self.y=y
def
On Wed, Dec 19, 2012 at 4:38 AM, Vlastimil Brom vlastimil.b...@gmail.comwrote:
2012/12/19 loïc Lauréote laureote-l...@hotmail.fr:
hi,
I
have a question,
is there a tool to calculate on list ?
something like :
a= [1,1,1,1]
b = [5,9,8,4]
c = a+b*a
print c
[6,10,9,5]
Thx
==
On Tue, Nov 26, 2013 at 4:01 PM, Victor Hooi victorh...@gmail.com wrote:
Hi,
I'm trying to use Python's new style string formatting with a dict and
string together.
For example, I have the following dict and string variable:
my_dict = { 'cat': 'ernie', 'dog': 'spot' }
foo =
On Wed, Nov 27, 2013 at 12:09 PM, Ned Batchelder n...@nedbatchelder.comwrote:
* Is there perhaps a better way to achieve what I'm trying to do?
What I'm really after, is to check that python expressions embedded in
text files are:
- well behaved (no syntax errors etc)
- don't accidentally
On Mon, Dec 16, 2013 at 2:19 PM, Djoser pedrovg...@gmail.com wrote:
Hi all,
I am new to this forum and also to Python, but I'm trying hard to
understand it better.
I need to create a binary file, but the first 4 lines must be in
signed-Integer16 and all the others in signed-Integer32. I
On Tue, Jan 21, 2014 at 11:04 AM, Travis Griggs travisgri...@gmail.comwrote:
Being a fan of JIT, I have big hopes for PyPy, I can’t figure out why they
aren’t pitching their “cutting edge” interpreter, for the “cutting edge”
version of python. There should be a wall of superpowers/shame for
On Wed, Apr 25, 2012 at 1:05 PM, Frank Miles f...@u.washington.edu wrote:
I have an exceedingly simple function that does a named import.
It works perfectly for one file r- and fails for the second x.
If I reverse the order of being called, it is still x that fails,
and r still succeeds.
On Thu, Apr 26, 2012 at 10:02 AM, Roy Smith r...@panix.com wrote:
I'm not seriously suggesting this as a language addition, just an interesting
idea to simplify some code I'm writing now:
x = [a for a in iterable while a]
which equates to:
x = []
for a in iterable:
if not a:
On Wed, May 2, 2012 at 12:51 PM, J. Mwebaze jmweb...@gmail.com wrote:
I have multiple objects, where any of them can serve my purpose.. However
some objects might not have some dependencies. I can not tell before hand if
the all the dependencies exsit. What i want to is begin processing from
On Wed, May 2, 2012 at 1:12 PM, Prasad, Ramit ramit.pra...@jpmorgan.com wrote:
I have multiple objects, where any of them can serve my purpose..
However
some objects might not have some dependencies. I can not tell before
hand if
the all the dependencies exsit. What i want to is begin
On Sun, May 13, 2012 at 12:11 PM, Bob Grommes bob.grom...@gmail.com wrote:
Noob alert: writing my first Python class library.
I have a straightforward class called Utility that lives in Utility.py.
I'm trying to get a handle on best practices for fleshing out a library. As
such, I've done
On Wed, May 23, 2012 at 12:42 PM, Dave Angel d...@davea.name wrote:
On 05/23/2012 03:13 PM, Emile van Sebille wrote:
A design decision -- there's currently a mix of methods that return
themselves and not. Mostly is appears to me that mutables modify in
place without returning self and
On Thu, Jul 26, 2012 at 11:01 AM, Dennis Lee Bieber
wlfr...@ix.netcom.comwrote:
On Thu, 26 Jul 2012 19:42:11 +1000, Chris Angelico ros...@gmail.com
declaimed the following in gmane.comp.python.general:
Well, if/while/for could be functions. So could with, probably. Now,
def would be a
On Tue, Jul 31, 2012 at 1:21 PM, Terry Reedy tjre...@udel.edu wrote:
Another example: KeyError and IndexError are both subscript errors, but
there is no SubscriptError superclass, even though both work thru the same
mechanism -- __getitem__. The reason is that there is no need for one. In
On Mon, Aug 6, 2012 at 12:50 PM, Mok-Kong Shen mok-kong.s...@t-online.dewrote:
I ran the following code:
def xx(nlist):
print(begin: ,nlist)
nlist+=[999]
This is modifying the list in-place - the actual object is being changed to
append 999. This can happen because lists are mutable
',
'd=dict.fromkeys(range(1000))')
19.922474218828711
timeit.timeit('for i in d: v=d[i]', 'd=dict.fromkeys(range(1000))')
31.00760415282
Chris
On Thu, Aug 9, 2012 at 2:49 PM, Chris Kaynor ckay...@zindagigames.com wrote:
On Thu, Aug 9, 2012 at 2:34 PM, Roman Vashkevich vashkevic...@gmail.com
On Thu, Aug 9, 2012 at 2:34 PM, Roman Vashkevich vashkevic...@gmail.com wrote:
Actually, they are different.
Put a dict.{iter}items() in an O(k^N) algorithm and make it a hundred
thousand entries, and you will feel the difference.
Dict uses hashing to get a value from the dict and this is
On Thu, Aug 9, 2012 at 3:26 PM, Dave Angel d...@davea.name wrote:
On 08/09/2012 06:03 PM, Andrew Cooper wrote:
On 09/08/2012 22:34, Roman Vashkevich wrote:
Actually, they are different.
Put a dict.{iter}items() in an O(k^N) algorithm and make it a hundred
thousand entries, and you will feel
Reading your post, I do not see for sure what your actual issue is, so
I am taking my best guess: that the file does not contain as much data
as would be expected.
On Wed, Aug 22, 2012 at 8:38 AM, William R. Wing (Bill Wing)
w...@mac.com wrote:
In the middle of a longer program that reads and
On Fri, Aug 24, 2012 at 12:43 PM, Willem Krayenhoff wbru...@gmail.comwrote:
Any idea why print isn't working here?
I tried restarting my Command prompt. Also, print doesn't work inside a
class.
[image: Inline image 2]
In Python 3, print was made into a function rather than a statement
On Fri, May 20, 2011 at 9:20 AM, Chris Angelico ros...@gmail.com wrote:
On Sat, May 21, 2011 at 1:50 AM, MRAB pyt...@mrabarnett.plus.com wrote:
[snip]
Is this strictly true? I thought that the hash value, an integer, is
moduloed (Is that how you spell it? Looks weird!) with the number of
On Tue, May 31, 2011 at 9:16 AM, Ian Kelly ian.g.ke...@gmail.com wrote:
On Tue, May 31, 2011 at 1:38 AM, Daniel Kluev dan.kl...@gmail.com wrote:
@decorator.decorator
def copy_args(f, *args, **kw):
nargs = []
for arg in args:
nargs.append(copy.deepcopy(arg))
nkw = {}
basestring, str, unicode, or bytes
might allow some oddness and possibly slightly worse performance.
Chris
On Tue, May 31, 2011 at 10:10 AM, Ian Kelly ian.g.ke...@gmail.com wrote:
On Tue, May 31, 2011 at 10:34 AM, Chris Kaynor ckay...@zindagigames.com
wrote:
Is there any reason
I'm making the presumption that you are using Python 2.x in my notes.
On Thu, Jun 2, 2011 at 3:07 PM, Keir Rice keirr...@gmail.com wrote:
Hi All,
The following function was showing up in my profiles as a large bottle
neck:
# Slow version
def RMSBand(self, histogram):
Calculates
On Jun 18, 2011, at 9:26, John Salerno johnj...@gmail.com wrote:
Whew, thanks for all the responses! I will think about it carefully
and decide on a way. I was leaning toward simply assigning the health,
resource, etc. variables in the __init__ method, like this:
def __init__(self, name):
You could probably implement something like this using generators and the
send method (note the example is untested and intended for 2.6: I lack
Python on this machine):
def gen(list_):
for i, v in enumerate(list_):
list_[i] = yield v
def execute():
data = range(10)
iterator =
On Mon, Mar 3, 2014 at 2:25 PM, Chris Angelico ros...@gmail.com wrote:
On Tue, Mar 4, 2014 at 9:19 AM, Cameron Simpson c...@zip.com.au wrote:
On 03Mar2014 09:17, Neal Becker ndbeck...@gmail.com wrote:
Charles R Harris charlesr.har...@gmail.com Wrote in message:
Imo the lesson here is
On Wed, Mar 5, 2014 at 9:43 AM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
At one time, Euler summed an infinite series and got -1, from which he
concluded that -1 was (in some sense) larger than infinity. I don't know
what justification he gave, but the way I think of it is
On Tue, Mar 11, 2014 at 9:13 AM, Josh English joshua.r.engl...@gmail.comwrote:
print list(sorted(all_the_stuff, key=lambda x: x.name.lower))
In this case, the key being sorted on is the function object x.name.lower,
not the result of the call.
It might make more sense if you break the lambda
On Tue, Mar 18, 2014 at 1:55 PM, Marko Rauhamaa ma...@pacujo.net wrote:
Dan Stromberg drsali...@gmail.com:
The results are at
http://stromberg.dnsalias.org/~strombrg/python-tree-and-heap-comparison/2014-03/
Size: 1048576, duration: 75.3, dictionary type: dict
[...]
Size:
On Thu, Mar 20, 2014 at 1:59 PM, Marko Rauhamaa ma...@pacujo.net wrote:
Well, with proper care, I suppose the same code base could support perl
as well. ;)
Go even farther; how about C, PHP, and bash? I'm sure if you tried, you
could mix in some Python as well.
On Thu, Nov 10, 2011 at 2:48 PM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
On Thu, 10 Nov 2011 14:38:58 -0500, Terry Reedy wrote:
I will point out that in the real world, dead donor transplants are
based on the fact the parts of the body do NOT have to die when the
On Mon, Nov 14, 2011 at 2:59 PM, MRAB pyt...@mrabarnett.plus.com wrote:
On 14/11/2011 21:53, Ethan Furman wrote:
The code in 'else' in a 'try/except/else[/finally]' block seems
pointless to me, as I am not seeing any difference between having the
code in the 'else' suite vs having the code in
As with any Python code, you can wrap the import into a try: except block.
try:
import badModule
except:
pass # Or otherwise handle the exception - possibly importing an
alternative module.
As with any except statement, specific exceptions may be caught
(rather than the blank, catch
On Tue, Nov 15, 2011 at 1:34 PM, Chris Angelico ros...@gmail.com wrote:
On Wed, Nov 16, 2011 at 8:20 AM, David Riley fraveyd...@gmail.com wrote:
Comparisons to singletons like None should always be done with
'is' or 'is not', never the equality operators.
Also, beware of
On Wed, Nov 16, 2011 at 8:57 AM, Frederic Rentsch
anthra.nor...@bluewin.ch wrote:
Hi all,
I'd like to log MySQL errors. If I do:
try: (command)
except MySQLdb.OperationalError, e: print e
I may get something like:
(1136, Column count doesn't match value count at row
On Mon, Dec 5, 2011 at 9:04 AM, Roy Smith r...@panix.com wrote:
Consider the following django snippet. Song(id) raises DoesNotExist if
the id is unknown.
try:
songs = [Song(id) for id in song_ids]
except Song.DoesNotExist:
print unknown song id (%d) % id
Is id
On Thu, Dec 15, 2011 at 9:57 AM, John Gordon gor...@panix.com wrote:
In 61edc02c-4f86-45ef-82a1-61c701300...@t38g2000yqe.googlegroups.com
noydb jenn.du...@gmail.com writes:
My sort issue... as in this doesn't work
if x.sort =3D=3D y.sort:
... print 'equal'
... else:
... print
On Wed, Dec 21, 2011 at 11:19 AM, hbd666 happybrown...@hotmail.com wrote:
snip
In my experience implementing Option 1 in another project, I know that
Python suspends
execution until the DLL function calls return, but I did not launch the
DLL on a thread.
I expect that if the DLL were
On Wed, Dec 21, 2011 at 2:10 PM, carlos choy happybrown...@hotmail.comwrote:
Thank you for your great advice. It is detailed and tells me what I need
to know, I wasn't expecting such an accurate response from anyone for some
time.
I think Option 2 is the way I will go. Having never
On Wed, Dec 21, 2011 at 2:25 PM, Eric einazaki...@yahoo.com wrote:
Is it true that if I want to create an array or arbitrary size such
as:
for a in range(n):
x.append(some function...)
I must do this instead?
x=[]
for a in range(n):
x.append(some function...)
You can
On Thu, Dec 22, 2011 at 1:11 PM, Saqib Ali saqib.ali...@gmail.com wrote:
MYCLASS.PY:
#!/usr/bin/env python
import os, sys, string, time, re, subprocess
import Singleton
This imports the module Singleton, not the class or function.
There are two options to deal with this:
from Singleton
On Wed, Jan 25, 2012 at 3:23 PM, Rick Johnson
rantingrickjohn...@gmail.comwrote:
On Jan 25, 3:45 pm, Ian Kelly ian.g.ke...@gmail.com wrote:
On Wed, Jan 25, 2012 at 1:14 PM, Rick Johnson
In all seriousness, the idea that very and somewhat are somehow
better in this context than pretty just
On Wed, Feb 1, 2012 at 9:11 AM, Olive di...@bigfoot.com wrote:
I am learning python and maybe this is obvious but I have not been able
to see a solution. What I would like to do is to be able to execute a
function within the namespace I would have obtained with from module
import *
For
On Thu, Feb 9, 2012 at 5:23 PM, noydb jenn.du...@gmail.com wrote:
hmmm, okay.
So how would you round UP always? Say the number is 3219, so you want
3300 returned.
You may want to look into the mathematical floor and ceiling functions[1].
Python exposes them in the math module as floor and
On Thu, Feb 9, 2012 at 5:40 PM, Chris Kaynor ckay...@zindagigames.comwrote:
On Thu, Feb 9, 2012 at 5:23 PM, noydb jenn.du...@gmail.com wrote:
hmmm, okay.
So how would you round UP always? Say the number is 3219, so you want
3300 returned.
You may want to look into the mathematical floor
On Thu, Feb 23, 2012 at 2:22 PM, Amirouche Boubekki
amirouche.boube...@gmail.com wrote:
2012/2/23 Manish Sharma manish2...@gmail.com
Hi I am new to python language. On my first day, somebody told me that
if any python script file is opened with any editor except python
editor, the file is
On Tue, Feb 28, 2012 at 1:04 PM, Craig Yoshioka crai...@me.com wrote:
I see that there was previously a PEP to allow the with statement to skip the
enclosing block... this was shot down, and I'm trying to think of the most
elegant alternative.
The best I've found is to abuse the for
On Wed, Mar 21, 2012 at 1:34 PM, Chris Rebert c...@rebertia.com wrote:
On Wed, Mar 21, 2012 at 12:30 PM, John Gordon gor...@panix.com wrote:
I'm writing an application that interacts with ldap, and I'm looking
for advice on how to handle the connection. Specifically, how to
close the ldap
On Tue, Mar 27, 2012 at 3:27 PM, Michael Poeltl
michael.poe...@univie.ac.at wrote:
hi,
can anybody tell why this 'little stupid *thing* of code' let's python-3.2.2,
2.6.X or python 2.7.2 segfault?
def get_steps2(pos=0, steps=0):
... if steps == 0:
... pos =
On Wed, Aug 25, 2010 at 2:23 PM, Glenn Hutchings zond...@gmail.com wrote:
On 25 Aug, 22:18, Ross Williamson rosswilliamson@gmail.com
wrote:
Is there anyway in a class to overload the print function?
class foo_class():
pass
cc = foo_class()
print cc
Gives:
The itertools module (http://docs.python.org/library/itertools.html) has
both permutations and combinations functionality.
Chris
On Mon, Sep 20, 2010 at 1:54 PM, Seth Leija fazzit...@gmail.com wrote:
I need to know how to generate a list of combinations/permutations
(can't remember which it
One of the advantages of using itertools is that it is written in C rather
than Python (at least for CPython) and thus should run significantly faster
than a pure Python implementation.
Chris
On Mon, Sep 20, 2010 at 4:21 PM, Dave Angel da...@ieee.org wrote:
On 2:59 PM, Seth Leija wrote:
I
On Wed, Oct 13, 2010 at 12:10 PM, Seebs usenet-nos...@seebs.net wrote:
On 2010-10-13, Jean-Michel Pichavant jeanmic...@sequans.com wrote:
If you wonder about some defects reported by such linters, you can then
ask in this list why something is not that good, because it may not be
always
On Wed, Oct 13, 2010 at 12:13 PM, Seebs usenet-nos...@seebs.net wrote:
On 2010-10-13, Chris Torek nos...@torek.net wrote:
Unfortunately with is newish and this code currently has to
support python 2.3 (if not even older versions).
I think it might be 2.4 and later. I'm not sure. Of
On Wed, Oct 13, 2010 at 12:12 PM, Seebs usenet-nos...@seebs.net wrote:
On 2010-10-13, Jonas H. jo...@lophus.org wrote:
Not really. Files will be closed when the garbage collector collects the
file object, but you can't be sure the GC will run within the next N
seconds/instructions or
Look up the string's rfind method.
Chris
On Wed, Oct 13, 2010 at 4:28 PM, Pratik Khemka pratikkhe...@hotmail.comwrote:
I want to search for a symbol in a string backwards..
For eg:
*line = my/cat/dog/baby*
**
*line.find('/')* *# but from the back...*
The reason I want to do this is
On Thu, Oct 28, 2010 at 9:16 AM, cbr...@cbrownsystems.com
cbr...@cbrownsystems.com wrote:
It's clear but tedious to write:
if 'monday in days_off or tuesday in days_off:
doSomething
I currently am tending to write:
if any([d for d in ['monday', 'tuesday'] if d in days_off]):
You may want to look at the collections.defaultdict class. It takes in a
factory function for default values.
You can also implement your class by overriding the __missing__ method of
the dict class, rather than overriding the __getitem__.
Both were added in Python 2.5 according to the
On Mon, Jul 14, 2014 at 3:24 PM, Catherine M Moroney
catherine.m.moro...@jpl.nasa.gov wrote:
Hello,
Pardon me for not using the proper Python language terms, but I hope that
people can still understand the question:
The problem: I'm writing a large Python program and I have a bunch of
On Mon, Jul 14, 2014 at 5:10 PM, LJ luisjoseno...@gmail.com wrote:
Hi All.
I'm coding a Dynamic Programming algorithm to solve a network flow
problem. At some point in the algorithm I have to iterate through a set of
nodes, while adding and/or removing elements, until the set is empty. I
On Tue, Jul 22, 2014 at 3:17 PM, emile em...@fenx.com wrote:
Then, how can I list all the function of pprint?
use the dir builtin:
dir (pprint)
['PrettyPrinter', '_StringIO', '__all__', '__builtins__', '__doc__',
'__file__', '__name__', '_commajoin', '_id', '_len', '_perfcheck',
On Fri, Jul 25, 2014 at 12:45 AM, 水静流深 1248283...@qq.com wrote:
never quit from the thread ,why?
I am going to guess that you can actually run code in the interpreter
here. When printing from threads, the prompt will end up in the wrong place
as the prompt is printed in the main thread.
On Mon, Jul 28, 2014 at 2:33 PM, Edward Manning ejmmann...@gmail.com
wrote:
I wrote this code, but it seem to work fine if I only have one ip in the
file. When I have more than one IP in the file
I get a error. Does anyone have an idea why.
It would be helpful to know what the error you are
On Wed, Jul 30, 2014 at 5:57 PM, Vincent Davis vinc...@vincentdavis.net
wrote:
On Wed, Jul 30, 2014 at 6:28 PM, Vincent Davis vinc...@vincentdavis.net
wrote:
The real slow part seems to be
for n in drugs:
df[n] =
df[['MED1','MED2','MED3','MED4','MED5']].isin([drugs[n]]).any(1)
I
1 - 100 of 210 matches
Mail list logo