On Tue, 2006-04-04 at 21:54 -0400, John Salerno wrote:
I'm reading Text Processing in Python right now and I came across a
comment that is helping me to see for loops in a new light. I think
because I'm used to the C-style for loop where you create a counter
within the loop declaration, for
A good
programmer always looks both ways when crossing a one way street.
I'm uncertain that a quip about abstracting away the rain would have
prompted the same adjective masterful now 10+ years in the future.
- Adam DePrince
--
http://mail.python.org/mailman/listinfo/python-list
On Fri, 2006-03-31 at 12:46 -0800, Karthik Gurusamy wrote:
Ben Finney wrote:
[EMAIL PROTECTED] writes:
I'm fairly new to python. I like to define a big dictionary in two
files and use it my main file, build.py
I want the definition to go into build_cfg.py and build_cfg_static.py.
On Fri, 2006-03-31 at 09:30 +0200, Fredrik Lundh wrote:
Dennis Lee Bieber wrote:
I want to know which is the best IDE for python.Please if
possible mention the features of the IDE.
The best IDE is the one that YOU can be most productive in. What /I/
find useful may not be of
( s )
s.reverseme()
print s
cbA
Other users of s between assignment and reversal (like
myfancy_structure) might not be happy that is was reversed when they
next must use it.
Cheers - Adam DePrince
--
http://mail.python.org/mailman/listinfo/python-list
? Print does seem to round at 12 digits.
print 1.090516455488E9/100
1090.51645549
Cheers - Adam DePrince
I know something with float and //...
Anybody?
How do I get correct number?
--
http://mail.python.org/mailman/listinfo/python-list
On Mon, 2006-03-27 at 16:15 -0800, [EMAIL PROTECTED] wrote:
After freezing a PYGTK app, I am unable to run it. It this a common
problem, because I could not find any documentation on it at all.
I tried freezing this example, which gets by the make as well, but
running it results in a
On Sun, 2006-03-26 at 07:21 -0800, Alex Martelli wrote:
vbgunz [EMAIL PROTECTED] wrote:
I am sorry I couldn't reply sooner! Alex, Python in a nutshell is my
bible and I take it virtually everywhere! Seriously, I would highly
recommend it to anyone with a little to a lot of Python
What do you get when you type
md5sum backup.tar.bz2?
- Adam
On Sun, 2006-03-26 at 16:56 +0200, Matthias Güntert wrote:
Hello list-members
i am in the process of writing a python script to backup my data. Now I
would like to implement md5/sha1 hashes.
# do md5 fingerprinting
On Sun, 2006-03-26 at 16:56 +0200, Matthias Güntert wrote:
Hello list-members
i am in the process of writing a python script to backup my data. Now I
would like to implement md5/sha1 hashes.
# do md5 fingerprinting
if config.get(global, crc) == md5:
m = md5.new()
On Fri, 2006-03-24 at 12:55 +0100, Clemens Hepper wrote:
Hello,
I've written a little (optimized) method to get a bit-string:
def bitstringneg(number, digits=32):
optimized for negative numbers
result =
for a in xrange(digits):
if number 1:
result += '1'
else:
Droppings from other timing tests; starbucks was kicking me out and I
was in a hurry.
Cheers - Adam DePrince
--
http://mail.python.org/mailman/listinfo/python-list
database really is the best place for that.
Good luck - Adam DePrince
--
http://mail.python.org/mailman/listinfo/python-list
. Z_FINISH. This is the default action, this is what is killing you.
Good luck - Adam DePrince
I cannot wait until the end of the stream and then flush, because I need to
flush after every packet.
Another capability I require is to be able to copy the compression stream.
i.e: To be able
On Fri, 2006-03-24 at 10:49 -0800, Robert Hicks wrote:
How about we all get tatoos? : )
... still trying to scrape the old one off ...
Robert
--
http://mail.python.org/mailman/listinfo/python-list
language changes, the second calls for a minor
(and likely symbolic) change to list comprehension's semantics to better
support future parallelism.
PEP: XXX
Title: Nondeterminism
Version: $Revision$
Last-Modified: $Date$
Author: Adam DePrince [EMAIL PROTECTED]
Status: Draft
Python-Version: 3.0
for key in d:
d[key] = [x*2 for x in d[key]]
Naw, if you are going to use list interpolation go all the way and save
yourself all of that ugly indexing into the dict.
d = {(100,500):[5,5], (100,501):[6,6], (100,502):[7,7]}
d.update( [[key,[x*2 for x in item]] for key,item in d.items()]
This is how python is supposed to work.
I'm sure not what languages you have used ... it seems that you are
expecting some sort rule based system like make, or prolog.
Grab a cup of joe, pull up a chair and let me help you out here.
Python is an imperative language, you can envision the presence
Yes, I cede that explicit indexing is faster by quite a bit.
There is a somewhat philosophical decision for why I avoided that. I
prefer to try to present python with as big of a picture of what I want
as possiable. update tells python what I want to do, whereas the
for-loop describes how to.
Wait! It occured to me. Why are we touching the key at all. This is
a dictionary with mutable values.
[EMAIL PROTECTED] ~]$ python2.4 -mtimeit -s 'd = {(100,500):[5,5],
(100,501):[6,6],
(100,502):[7,7]}; x = dict(d)' 'for i in x.values():
i[:]=[j*1 for j in i]'
10 loops, best of 3: 2.79
Excuse me, I mean
python2.4 -mtimeit -s 'from numarray import array; d =
{(100,500):[5,5], (100,501):[6,6],
(100,502):[7,7]}; x = dict(d);' 'for i in x.values():
i[0]*=1;i[1]*=1'
100 loops, best of 3: 1.72 usec per loop
i[0]*=1, not j[0]*=1 ...
--
luck - Adam DePrince
--
http://mail.python.org/mailman/listinfo/python-list
. But whatever you do, don't beg.
Adam DePrince
--
http://mail.python.org/mailman/listinfo/python-list
On Tue, 2005-02-15 at 14:25, Ilias Lazaridis wrote:
Adam DePrince wrote:
On Tue, 2005-02-15 at 13:29, Ilias Lazaridis wrote:
Mike Meyer wrote:
Ilias Lazaridis [EMAIL PROTECTED] writes:
[...]
MinGW compatibility is not [only] my need.
It is an community need [at least partially
On Tue, 2005-02-15 at 17:24, Jeff Shannon wrote:
Ilias Lazaridis wrote:
Adam DePrince wrote:
[...]
You're on it. You drive a car? You have to treat it right to get what
you want, right? Same here. Ask correctly, and you will get your
answers.
Your interpretation/definition
',
then you do 1D FFTs on all the columns of X'.
So, for a 32x32 2D FFT, you'll end up doing 64 1D FFTs.
FFTW: http://www.fftw.org/
Python bindings for it: http://pylab.sourceforge.net/
Adam DePrince
--
http://mail.python.org/mailman/listinfo/python-list
the paragraph above with 'a fixed point' substituted for
'minimal'.
How is spencerator different than itertools.tee?
Adam DePrince
--
http://mail.python.org/mailman/listinfo/python-list
it as you would
such a creature in C ...
vTable[0][0] = 1
or whatever you want to do.
I've seen this question before. Lot in the archives for the subject 2D
array from Dec 7th 2004 - Dec 10th 2004.
Steven and I recommended roughly opposite solutions at the time :-)
Adam DePrince
--
http
that execution speed is a
real issue for your programming task (in order to continue this
discussion). Otherwise the debate will go south real quick.
Not only most speed be an issue, but the economics must be such that any
alternative is better than throwing more hardware at the problem.
Adam
on obscurity: The bad guys are rounding
off your pennies as you read this.
The worse case if you depend on encryption and open your spec: You get
to publish your code, but might get competition.
Just my $0.02.
Adam DePrince
--
http://mail.python.org/mailman/listinfo/python-list
of this scheme is dependent on a lot, including
the strength of sha, your ability to keep your secret key secret, the
correctness of what I'm saying, etc etc etc.
Adam DePrince
--
http://mail.python.org/mailman/listinfo/python-list
On Sun, 2005-02-06 at 08:19, Philippe Fremy wrote:
Adam DePrince wrote:
No amount of obfuscation is going to help you.
Theorically, that's true. Anything obfuscated can be broken, just like
the non obfuscated version. However it takes more skills and time to
break it. And that's
as a hedge against malicious data. Can I, as a user of
said card, change the data in the pickle? If so, when you load the
pickle back into python you need to confirm that it is a sane pickle
that you wrote earlier.
- Adam
Adam DePrince
--
http://mail.python.org/mailman/listinfo/python-list
-rf %(HOME)s%os.environ )
as the expression to evaluate.
Adam DePrince
--
http://mail.python.org/mailman/listinfo/python-list
are tring to do; perhaps there is a better
way, perhaps the problem is unsolvable and there is a heuristic that
will satisfy your needs.
Adam DePrince
--
http://mail.python.org/mailman/listinfo/python-list
many
cameras, so there are many threads simultaneously reading and dropping them
in a central Queue for saving later.
I appreciate it!
-Dave
WebImage = urllib.urlopen(http://ip-address/jpg/image.jpg).read()
QueuePacket = []
QueuePacket.append(WebImage)
Adam DePrince
--
http
On Fri, 2004-12-31 at 17:36, Steven Bethard wrote:
Adam DePrince wrote:
Lets not forget the real reason for lambda ... the elegance of
orthogonality. Why treat functions differently than any other object?
We can operate on every other class without having to involve the
namespace
On Fri, 2004-12-31 at 22:09, Terry Reedy wrote:
Adam DePrince [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
In sort, we must preserve the ability to create an anonymous function
simply because we can do so for every other object type, and functions
are not special enough
On Sat, 2005-01-01 at 11:42, Steve Holden wrote:
Adam DePrince wrote:
[...]
In sort, we must preserve the ability to create an anonymous function
simply because we can do so for every other object type, and functions
are not special enough to permit this special case.
And you'd
type, and functions
are not special enough to permit this special case.
Adam DePrince
--
http://mail.python.org/mailman/listinfo/python-list
a look at
http://python.org/community/lists.html The news group and this list are
mirrors of each other. Of course, the benefit this provides depends on
which mail client you use.
Adam DePrince
--
http://mail.python.org/mailman/listinfo/python-list
On Sun, 2004-12-19 at 23:43, Jp Calderone wrote:
On Sun, 19 Dec 2004 23:12:27 -0500, Adam DePrince [EMAIL PROTECTED] wrote:
[snip]
Of course, to take advantage of this requires that writev be exposed. I
have an implementation of writev. This implementation is reasonably
smart
On Mon, 2004-12-20 at 02:18, Steven Bethard wrote:
Adam DePrince wrote:
file.writelines( seq ) and map( file.write, seq ) are the same; the
former is syntactic sugar for the later.
Well, that's not exactly true. For one thing, map(file.write, seq)
returns a list of Nones, while
iteration.next()'s, you can set an optional parameter to a smaller
value.
I'm not sure where to take this as a next step. It seems too small a
change for a PEP. Any ideas?
You can download the patch from
http://deprince.net/software/writev/index.html
Adam DePrince
--
http://mail.python.org
On Sun, 2004-12-19 at 23:43, Jp Calderone wrote:
On Sun, 19 Dec 2004 23:12:27 -0500, Adam DePrince [EMAIL PROTECTED] wrote:
[snip]
[snip]
to free the memory, of course.
The support of iterators is a cool idea, but I'm not sure
it is actually useful. Consider the case where not all
On Mon, 2004-12-20 at 00:30, Steven Bethard wrote:
Adam DePrince wrote:
Many other programmers have faced a similar issue; cStringIO,
''.join([mydata]), map( file.write, [mydata]) are but some attempts at
making this process more efficient by jamming the components to be
written
. And if you
were in the wannabe category, you got yourself a PET 20 and told it what
to do in BASIC.
(mumbles into beard and drools quietly in the corner).
Adam DePrince
--
http://mail.python.org/mailman/listinfo/python-list
, 1.7002, 1.8, 1.8999, 2.0]
Adam DePrince
--
http://mail.python.org/mailman/listinfo/python-list
.) But you are
forced to memorize the same list of curse words over and over again in
order. This is the BASIC way of learning to program.
Don't do it, unless your goal is simply to embarrass and insult
programmers.
Adam DePrince
--
http://mail.python.org/mailman/listinfo/python-list
,templates}'
Does this help?
- Adam
Adam DePrince
--
http://mail.python.org/mailman/listinfo/python-list
in terms of maping here. Don't say ...
for ...
Think ...
message = map( ord, message )
or
message = [chr( (ord( x ) + 3 )%256) for x in message]
Adam DePrince
--
http://mail.python.org/mailman/listinfo/python-list
. And to properly stand upon those
shoulders, we must match the theoretical models used. That means we
need more, not fewer, immutable counterparts to most of our datatypes.
Adam DePrince
--
http://mail.python.org/mailman/listinfo/python-list
that is a good
thing.
Adam DePrince
--
http://mail.python.org/mailman/listinfo/python-list
, inmutable counterparts to most of our datatypes.
Adam DePrince
--
http://mail.python.org/mailman/listinfo/python-list
répondre en français.
- Adam DePrince
--
http://mail.python.org/mailman/listinfo/python-list
= f.readline()
print line,
line = f.readline()
print line,
line = f.readline()
print line,
f.unreadline( line )
line = f.readline()
print line,
line = f.readline()
print line,
Running this prints:
a
b
c
c
d
Hope this helps.
Adam DePrince
, Python for that matter. Practice casting problems as classes in
Python and submit them here for praise and criticism.
Lastly, Perl is an OOPl in its own right ... like Python and quite
unlike Java, it doesn't jam its OOP-ness down your throat.
Adam DePrince
--
http://mail.python.org/mailman
. Largely this problem is intractable, even with simplifications,
but it is done which is why safety critical programs are (well, should
be) small and their languages not very expressive (as in finite state
machine, and not in the but my computer is a FSM sense.)
Adam DePrince
--
http
():
... a[:] = []
...
b()
a
[1, 2]
c()
a
[0, 2]
d()
a
[]
Now forgive me ... what you really want to do is follow Erik's advice.
Adam DePrince
--
http://mail.python.org/mailman/listinfo/python-list
cycles per array reference
was a big thing back then ...
Anyhow, sorry about babbling on about this non-python related nonsense
and good luck.
Adam DePrince
--
http://mail.python.org/mailman/listinfo/python-list
might want to consider using a dictionary
where the key is a tuple representing the coordinates.
a = {}
a[(0,0)] = 0
a[(0,1)] = 1
a[(1,0)] = 2
a[(1,1)] = 3
a[(2,0)] = 4
a[(2,1)] = 5
a[(3,0)] = 6
a[(3,1)] = 7
a[(4,0)] = 8
a[(4,1)] = 9
a.get( (3,0), None )
6
print a.get( (5,0), None )
None
Adam
to do on 10^8 elements with repeats in the keys? I
guess I should just try and see for myself.
Repeats in the keys don't matter.
Adam DePrince
--
http://mail.python.org/mailman/listinfo/python-list
On Wed, 2004-12-08 at 15:02, Steven Bethard wrote:
Adam DePrince wrote:
def flatten( i ):
try:
i = i.__iter__()
while 1:
j = flatten( i.next() )
try:
while 1:
yield j.next()
except
On Wed, 2004-12-08 at 15:06, Steven Bethard wrote:
Adam DePrince wrote:
If your data is sparse you might want to consider using a dictionary
where the key is a tuple representing the coordinates.
a = {}
a[(0,0)] = 0
a[(0,1)] = 1
[snip]
print a.get( (5,0), None )
Good point
callbacks ...
- Adam
Using Python 2.3, IDLE and Win2k.
Thanks for your time
Jean Montambeault
Adam DePrince
Adam DePrince
--
http://mail.python.org/mailman/listinfo/python-list
operator returns true if its
two parameters internally have the same pointer value and are the same
object.
Floating point values are not interned, so 1.1 is 1.1 is false.
Adam DePrince
--
http://mail.python.org/mailman/listinfo/python-list
deal clearer.
from sets import Set
set_a = Set( [(i,round(j)) for i,j in a] )
set_b = Set( [(i,round(j)) for i,j in b] )
set_a.intersection( set_b )
Set([(123, 2.0), (123, 1.0), (123, 8.0)])
Or you could say ...
set_a, set_b = [[Set((i,round(j))) for i,j in s] for s in (a,b )]
Adam
://promotions.yahoo.com/new_mail
Adam DePrince
--
http://mail.python.org/mailman/listinfo/python-list
68 matches
Mail list logo