Title: PyAr - Python Argentina 10th Meeting, Thursday, August 4th
The Argentine Python User Group, PyAr, will have its tenth
meeting this Thursday, August 4th at 7:00pm.
Agenda
--
Despite our agenda tends to be rather open, this time we would
like to cover these topics:
- Discuss
Jon Hewer wrote:
Hi
I'm pretty new to Python, and recently been working my way through
Dive Into Python, and I'm currently writing a really simple rss reader
purely to get familiarised with the language. I want to move onto
something a little more challenging, but I'm stuck for ideas on
Mike Meyer wrote:
Mike Meyer [EMAIL PROTECTED] writes:
I think you'll find that wxPython installs perfectly on Tiger using
the package provided. Indeed, the only really painful platform to
install wxPython on is Linux, where you pretty much need to build from
source if you want the latest and
Paul McNett wrote:
Mike Meyer wrote:
Mike Meyer [EMAIL PROTECTED] writes:
I think you'll find that wxPython installs perfectly on Tiger using
the package provided. Indeed, the only really painful platform to
install wxPython on is Linux, where you pretty much need to build from
source if you
on 04.08.2005 00:36 Michael Sparks said the following:
Peter Tillotson wrote:
I'm quite interested in the mini version and also using the modules as
mobile code rather than installing it formally.
I'll document it slightly better and post up on the website in the next 48
hours or so. In the
I know I came after the battle. And I have just another sight on context
managment.
Simple Context Managment may look in Python 2.4.1 like this:
Synhronized example:
def Synhronised(lock,func):
lock.acquire()
try:
func()
finally:
pyparsing is very convenient to use. But I want to find some a py tool
to parse non-English strings. Does pyparsing support UNICODE strings?
If not, can someone tell me what py tool can do it? Thanks in advance.
--
http://mail.python.org/mailman/listinfo/python-list
But it would be a nice enhancement to add the option for auto-emailing
in case
of trouble.
I like still like e-mail notices (it has a nice format we are used to as we use
to communicate other things, and you can parse the text easily)... but I
wonder: given the spam / virus induced
Hello,
as a relative newcomer to Python API programming I've got a problem:
To extend Python:
- there is an API C call to create a module
- there is also a API C call to create a method
- there is an API C call to create a Class instance
Now, I need to create a Class and fill it with Methods
i have read
finding sublist
http://groups.google.it/group/comp.lang.python/browse_thread/thread/50b09a0aca285256/5156ada81fc9358a?hl=it#5156ada81fc9358a
the problem was in a string to find if we have two substring non
overlapping of lenght al least 4
it was done by
Stephan wrote:
Can the CSV module be coerced to read two line formats at once or am I
better off using read and split?
Yes, it can:
import csv
import sys
reader = csv.reader(sys.stdin)
while True:
try:
names = reader.next()
values = reader.next()
except
On 25/07/05, Diez B.Roggisch [EMAIL PROTECTED] wrote:
Varghjärta varghjarta at gmail.com writes:
If I have GUIClass:...
And start another thread and from that thread I want to call the
method PaintSomething() in GUIClass _in_ the same thread that
GUIClass lives in.
There is no such
Hallöchen!
Dennis Lee Bieber [EMAIL PROTECTED] writes:
On Thu, 04 Aug 2005 00:53:28 -0400, Mike Meyer [EMAIL PROTECTED] declaimed
the following in comp.lang.python:
No, it's not a discussion about estimates. The average household
in a G8 country has more computers that don't run Windows -
Thanks i'll check it out. I'm not very good yet tho!
On 8/4/05, Stuart Turner [EMAIL PROTECTED] wrote:
Jon Hewer wrote:
Hi
I'm pretty new to Python, and recently been working my way through
Dive Into Python, and I'm currently writing a really simple rss reader
purely to get
could ildg wrote:
pyparsing is very convenient to use. But I want to find some a py tool
to parse non-English strings. Does pyparsing support UNICODE strings?
If not, can someone tell me what py tool can do it? Thanks in advance.
Try it!
# vim:fileencoding=utf-8
from pyparsing import Word
Tom Anderson wrote:
On Mon, 1 Aug 2005, Peter Otten wrote:
Harald Massa wrote:
Always go to bed exactly when you want to write the first lambda.
Eureka. The Twentieth Pythonic Thesis has finally surfaced.
So what does it mean that i do much of my programming in bed?
You may want to
I want to parse some Chinese words.
It seems that pyparsing doesn't work for me.
Thank you.
I have to use re directly, although it's harder, but it'll always work.
On 8/4/05, Robert Kern [EMAIL PROTECTED] wrote:
could ildg wrote:
pyparsing is very convenient to use. But I want to find some a
On Tue, 26 Jul 2005 22:08:25 +0200, Caleb Hattingh [EMAIL PROTECTED] wrote:
Since you are on this topic, do you (or anyone else) have any type of
code-completion mode for python in emacs?
Thanks
-george
For what its worth, Vim has a generic type of code-completion that uses
the file
Hi all,
I'm a programming dabbler trying learn Python, and I've got a few
questions.
Mainly: Where can I find a good open-source library or tutorial
(preferably free) that explains how to easily manipulate text in a
tKinter window? Basically, I want to be able to do anything that HTML
can do (or
kman3048 schrieb:
Now, I need to create a Class and fill it with Methods and Variables.
There are means to create (and attache) methods and variables.
However, I have not found how to create a Class within a Module. Or do
import aModule
c = aClassGenerator()
setattr(aModule,'c',c)
ci =
Hi Stefan,
It seems as though all components basically have to do busy waiting now.
You are right - components are, for the most part, busy-waiting. Which
is not a good thing!
So do you plan on including a kind of scheduler-aware blocking
communication (like the `channels` of the `tasklets`
OK, I make it.
It's right, it can work fine with unicode.
pyparsing is great.
Thanks.
On 8/4/05, could ildg [EMAIL PROTECTED] wrote:
I want to parse some Chinese words.
It seems that pyparsing doesn't work for me.
Thank you.
I have to use re directly, although it's harder, but it'll always
So what's you code?
and what's you system default encoding?
On 8/4/05, saddle [EMAIL PROTECTED] wrote:
hello, but i can't run the script. could u told me what's the trick pls?
here is the error output.
D:\python\testpyp
sys:1: DeprecationWarning: Non-ASCII character '\xce' in file
I solved the problem. The reason was uncomplete email message
msg should be like this
timezone = ' %+03d%02d' % (-time.timezone/3600, time.timezone%3600)
MessageSubject=This is a subject
BodyMessage=This is a body
msg='From: '+fromaddr+' '+fromaddr+'\nTo:
'+toaddrs+''+toaddrs+'\nDate: '+
kman3048 wrote:
Hello,
as a relative newcomer to Python API programming I've got a problem:
To extend Python:
- there is an API C call to create a module
- there is also a API C call to create a method
- there is an API C call to create a Class instance
Now, I need to create a Class
I tested his code in a file test2.py:
# -*- coding: UTF-8 -*-
from pyparsing import Word
text = Καλημέρα, κόσμε!.decode('utf-8')
alphas = u''.join(unichr(x) for x in xrange(0x386, 0x3ce))
greet = Word(alphas) + u',' + Word(alphas) + u'!'
greeting = greet.parseString(text)
print greeting
After
Alexander Eisenhuth [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
ActivePython 2.4.1
Windows XP
I write a COM Server in VC++ 6.0 using ATL. So far so good. While I
develop I got sometimes strange behaviour with makepy utility. Today
again. :-(
SyntaxError: invalid syntax
I think you just need do:
sh.Range(sh.Cells(4,1),sh.Cells(6,3)).Value =
sh.Range(sh.Cells(1,1),sh.Cells(3,3)).Value
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] wrote:
I need to write a .cgi that will take the content of an https GET or
POST and send it securely as email to an Outlook client.
I think that OpenSSL is somewhere in this, but I'm not even sure how to
create the right certificate, how to use it to encrypt mail and how
[EMAIL PROTECTED] wrote:
I need to write a .cgi that will take the content of an https GET or
POST and send it securely as email to an Outlook client.
I think that OpenSSL is somewhere in this, but I'm not even sure how to
create the right certificate, how to use it to encrypt mail and how
Martin P. Hellwig wrote:
I think you want this more common approach for mail encryption:
server:
https CGI form -- mail wrapper -- PGP encryption/signing -- send
client:
recieve mail -- pgp decryption/verification -- read
This would require an additional PGP-plugin for Outlook. Outlook
Steve Jorgensen wrote:
I was working with a friend on a project Monday night, and tried to run a
pyunit test from Eclipse, and nothing seemed to happen. We finally figured
out that the test is doing exactly what it's supposed to do, but the pyunit
output isn't making it to the Eclipse console
Mage wrote:
cut
Thank you, I will check this out. My company will switch to a jsp site.
cut
Well I don't know your company and how many developers there are but I
know this; a manager telling me what tools to use to do my job is a bad
manager by definition because he should realize that the
Michael Ströder wrote:
Martin P. Hellwig wrote:
I think you want this more common approach for mail encryption:
server:
https CGI form -- mail wrapper -- PGP encryption/signing -- send
client:
recieve mail -- pgp decryption/verification -- read
This would require an additional PGP-plugin
Hello,
I have a class measurement representing a physical measurement.
Different objects in this class represent laboratory equipment, which
might raise an exception (e.g. overtemperature).
In any case the equipment has to be switched off after the experiment,
since if a
power supply stays in
Martin P. Hellwig wrote:
Michael Ströder wrote:
Martin P. Hellwig wrote:
I think you want this more common approach for mail encryption:
server:
https CGI form -- mail wrapper -- PGP encryption/signing -- send
client:
recieve mail -- pgp decryption/verification -- read
This would
Hello.
I'd to use gauge component in the code below. I want to show
Queue.quantity in gauge (during running thread, every time when it
changed). I don't know which event i must use. I find some info about
Time event for gauge but don't understand how it works. Any
suggestions?
[EMAIL PROTECTED] wrote:
Hello,
I have a class measurement representing a physical measurement.
Different objects in this class represent laboratory equipment, which
might raise an exception (e.g. overtemperature).
In any case the equipment has to be switched off after the experiment,
James Kew schrieb:
Alexander Eisenhuth [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
ActivePython 2.4.1
Windows XP
I write a COM Server in VC++ 6.0 using ATL. So far so good. While I
develop I got sometimes strange behaviour with makepy utility. Today
again. :-(
SyntaxError:
Hi,
Does anyone have embedded a python interpreter on a proprietary hardware ?
I have a home made hardware running a home made OS. C is used as programming
language. I'd like to add a python interpreter to my system.
Any guidelines ?
Nicolas
--
Hello Benjamin,
What would happen if an exception was thrown in the middle of setup()?
tearDown could not handle this case without having a list of the
objects already constructed (Or I would have to rely on the automatic
call to __del__, if it is reliable).
There is still some problem:
Imagine
Your own feature request for setUpOnce() and tearDownOnce() is
trivially coded using a global or class variable to restrict running to
a single occasion. If that seems unpleasant, then encapsulate the
logic in a subclass of TestCase, in a decorator, or in a metaclass.
Ok, you can have a
In article [EMAIL PROTECTED],
Stephan [EMAIL PROTECTED] writes
I'm fairly new to python and am working on parsing some delimited text
files. I noticed that there's a nice CSV reading/writing module
included in the libraries.
My data files however, are odd in that they are composed of lines with
Hi!
I am new to this list, and maybe this is a stupid question, but I
can't seem to find _any_ kind of answer anywhere.
What I want to do is the following:
I want to insert a class variable into a class upon definition and
actually use it during definition.
Manually, that is possible, e.g.:
I have encountered some problems with PyGTK only when I was trying to
install a PyGTK version that was different from the installed GTK+
version. When those both versions were the same, I had no problems at
all.
(Another problem with PyGTK is that it's installation is somewhat more
complicated
I am using windows Qt3.3.4 and want to verify the selected file path on
pressing the OK button of File Dialog. After checking I don't want to
close the QFileDialog.
Can anyone tell me how to stop closing the FileDialog after checking
the file path on pressing ok button.
--
Jan-Ole Esleben wrote:
class Meta(type):
def __new__(cls, name, bases, d):
d['classvar'] = []
return type.__new__(cls, name, bases, d)
The problem is that __new__ is called upon object construction, not
class definition, but you're trying to set the class variables at
Hi,
I am using ant to run junit to run a java class that uses
a PythonInterpreter to execute a script. The script
complains about a ImportError: cannot import name ...
despite the fact that junit, on behalf of ant -v
pretends to be using exactly the right classpath.
Obviously the classpath does
[EMAIL PROTECTED] wrote:
i have read
finding sublist
http://groups.google.it/group/comp.lang.python/browse_thread/thread/50b09a0aca285256/5156ada81fc9358a?hl=it#5156ada81fc9358a
the problem was in a string to find if we have two substring non
overlapping of lenght al least 4
it was
I thought __new__ was called upon construction of the _class_ object
that Meta is the type of. Then it would be available at the time of
the definition of my class. Or am I mistaken?
Ole
2005/8/4, Christopher Subich [EMAIL PROTECTED]:
Jan-Ole Esleben wrote:
class Meta(type):
def
Mage Wrote:
I would be surprised if there were more than five python jobs in my
country but have to look around.
I Reply:
It's not quite that bad in Arkansas (USA), but when I was hired to help
start a new IT department I insisted on using Python and my employer
agreed to try it. I now have over
Hi,
1.I have installed and running a plone Intranet site,
I have registerd users on it. I want to get list of all registerd users
on a page. how I should move towards getting it / scripting it in my
index_html page ?
I am just a frontend user of plone.
2.How to start creating small database
Jan-Ole Esleben wrote:
Yes, that works, but it is unfortunately not an option (at least not a
good one).
Is there no way to create a class variable that exists during
definition of the class? (I cannot imagine there isn't, since
technically it's possible and manually it can be done...)
Ole
nico wrote:
Does anyone have embedded a python interpreter on a proprietary hardware ?
Yes, http://www.cybertec.com.au/microcore.htm
I have a home made hardware running a home made OS. C is used as programming
language. I'd like to add a python interpreter to my system.
Any guidelines ?
I found my problem it wasn't this piece of the problem it was
another...
Thanks.
However if you want a working example go here..
http://www.onlamp.com/pub/a/python/2005/06/02/logging.html
--
http://mail.python.org/mailman/listinfo/python-list
but in general is there a way to include in a re, in this example
something like...matches iff p , and q in which p==q[::-1] ? A way to
putting a small part of code of python in re? Thanx for your many helps
--
http://mail.python.org/mailman/listinfo/python-list
a manager telling me what tools to use to do my job is a bad
manager by definition because he should realize that the people who
best
know what tools to use are the peope who use the tools*.
I'm sorry, this doesn't make much sense to me. In an ideal world where
all developers are all knowing and
While I try to install python arise an error:
I type
./configure
...
...
checking for g++ ... no
checking for gcc ... gcc
checking for C++ compiler default output file name ... configure: error:
C++ compiler cannot create executables
See 'config.log' for more details.
config.log is
This
[EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
I don't know what 'tactis' is, but 'mbcs' is not a portable character set
name.
It's a special character set name on win32, which refers to some
system-specific
multibyte character set.
I don't think these failures are a Python
Belyh G.P. wrote:
Belyh G.P. wrote:
OS - Debian GNU/Linux 3.1
Sorry forgor Hi all! :)
--
http://mail.python.org/mailman/listinfo/python-list
rh0dium wrote:
for mod in modules:
a = mod.mod()
a.run()
Puzzle: If mod.mod did what you expect, what would a.run have to do to
maintain consistency?
There would be no way to determine the name of the module bound to the mod
variable, but fortunately the Python developers foresaw
Thank you all for these interesting examples and methods!
Supposing I want to use DictReader to bring in the CSV lines and tie
them to field names, (again, with alternating lines having different
fields), should I use two two DictReaders as in Christopher's example
or is there a better way?
--
Stephan wrote:
Thank you all for these interesting examples and methods!
You're welcome.
Supposing I want to use DictReader to bring in the CSV lines and tie
them to field names, (again, with alternating lines having different
fields), should I use two two DictReaders as in Christopher's
Thanks! It's a bit icky, yes, but I've been so wrapped up in
complicated thinking that I didn't see this. It's actually quite an
OK solution (I need it because I have an internal representation for
method interfaces that needs to be saved somewhere without the user
having to worry about it, and
Peter Otten wrote:
rh0dium wrote:
for mod in modules:
a = mod.mod()
a.run()
Puzzle: If mod.mod did what you expect, what would a.run have to do to
maintain consistency?
I thought that once a = example.example the class is then loaded.
Since my framework defines a python file
handy.
Thanks,
Bill
[EMAIL PROTECTED] wrote:
Here's some code that gives a cut-copy-paste pop-up window on all Entry
widgets
in an application.
This code is released into the public domain.
Jeff Epler
#
import
Terry Reedy wrote:
Michael Sparks [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
def updater(interval, message):
t = time.time():
while 1:
if time.time() - t interval:
print message
yield None # add this
Yes. (I can't believe I missed that
On Thu, Aug 04, 2005 at 03:59:01PM +0100, Richard Brodie wrote:
I suppose, for consistency, it should ideally raise LookupError, though
Maybe so. If that was the poster's point, then I completely missed it.
Jeff
pgpUjJySHoMrY.pgp
Description: PGP signature
--
Michael Ströder wrote:
cut
This would require an additional PGP-plugin for Outlook. Outlook can
decrypt S/MIME messages out-of-the-box.
Yes indeed, although I personaly find pgp a bit more elegant your
solution would be the best for the OP.
cut
Whether S/MIME or PGP is used depends very much on
[EMAIL PROTECTED] wrote:
Hello Benjamin,
What would happen if an exception was thrown in the middle of setup()?
tearDown could not handle this case without having a list of the
objects already constructed (Or I would have to rely on the automatic
call to __del__, if it is reliable).
class
Here's an example...
BEGIN TEST.PY
import sys
print Original:, sys.argv
for arg in sys.argv:
arg = arg.strip('-\x93\x96') # add chars here you want to strip
print Stripped:, arg
END TEST.PY
--
http://mail.python.org/mailman/listinfo/python-list
Can't help you with #1 as I don't use Plone anymore. I prefer using
plain Zope and building my site around that. There's not much that
Plone adds for me, besides a skin.
As for 2, I do have some experience doing that. First, create a ZSQL
statement that does something like this:
select * from
Please explain in more detail exactly what your problem was using the
method you described. We can help you, but most would be hard pressed
to write your code for you.
--
http://mail.python.org/mailman/listinfo/python-list
On Mon, 01 Aug 2005 10:49:36 -0500, Paul Watson [EMAIL PROTECTED] wrote:
[EMAIL PROTECTED] wrote:
Hi,
My company is involved in the development of many data marts and
data-warehouses, and I currently looking into migrating our old set of
tools (written in Korn) to a new, more dynamic and
[EMAIL PROTECTED]
My questions are:
1) under normal conditions (no exceptions) is there a guarantee, that
__del__ of
all instruments is called at the end of measurement()?
2) if an exception is thrown, will all instruments be deleted if the
error
occurs in run() ?
(only the instruments
[Sylvain Thénault]
I'm pleased to announce a new release of PyLint.
Bonjour Sylvain. J'ai la compulsion de dire bonjour, et merci! (On
peut me tutoyer sans problème.)
Ce logiciel `pylint', que je viens d'installer et d'essayer pour la
première fois ce matin (donc, j'écris encore sur l'effet
falcon [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
def Synhronised(lock,func):
lock.acquire()
try:
func()
finally:
lock.release()
lock=Lock()
def Some():
local_var1=x
local_var2=y
local_var3=Z
def
borges2003xx at yahoo.it borges2003xx at yahoo.it writes:
but in general is there a way to include in a re, in this example
something like...matches iff p , and q in which p==q[::-1] ? A way to
putting a small part of code of python in re? Thanx for your many helps
What you are after is a
does anyone have sample code for parsting an html file to get contents
of a td field to write to a mysql db? even if you have everything but
the mysql db part ill take it.
thanks
yaffa
--
http://mail.python.org/mailman/listinfo/python-list
yaffa [EMAIL PROTECTED] wrote:
does anyone have sample code for parsting an html file to get contents
of a td field to write to a mysql db? even if you have everything but
the mysql db part ill take it.
I usually use Expat XML parser to extract the field.
On 4 Aug 2005 11:54:38 -0700, yaffa [EMAIL PROTECTED] wrote:
does anyone have sample code for parsting an html file to get contents
of a td field to write to a mysql db? even if you have everything but
the mysql db part ill take it.
Do you want something like this?
In [1]: x = something
Below is a simple code snippet showing a Tkinter Window bearing a
canvas and 2 connected scrollbars (Vertical Horizontal). Works fine.
When you shrink/resize the window the scrollbars adjust accordingly.
However, what I really want to happen is that the area of the canvas
that the scrollbars
We are in the process of standardizing ~10 Linux servers on Lineox 4.x,
which is a variant of RedHat Enterprise server I'm told. Part of that
process is to standardize python.
The baseline install includes python 2.3 which is adequate, but I would like
to standardize on 2.4.1, because it is the
yaffa wrote:
does anyone have sample code for parsting an html file to get contents
of a td field to write to a mysql db? even if you have everything but
the mysql db part ill take it.
http://www.crummy.com/software/BeautifulSoup/examples.html
--
I had a similar problem when trying to compile Python 2.4.1 on AIX. The
configure script complained about not finding 'cc_r'. I simply did 'ln
-s /usr/bin/gcc /usr/bin/cc_r' and that solved my problem. You may
consider doing the same for cclplus.
Grig
--
On Thu, 2005-08-04 at 01:04 -0400, Mike Meyer wrote:
Right. Let's go back to the original question: What's the app I use on
Unix that acts like py2exe on Windows and py2app on Unix?
Any archiving system can be coerced into collecting all the parts
together. None of them do it automatically.
Thanks for your help guys! That cleared some stuff up for me. Now I
just have to wait for the sysadmin to get back from his vacation, bah.
Scott
--
http://mail.python.org/mailman/listinfo/python-list
Casey Hawthorne [EMAIL PROTECTED] writes:
Is there a way to determine -- when parsing -- if a word contains a
builtin name or other imported system module name?
Like iskeyword determines if a word is a keyword!
Look in the keyword module; there is actually an iskeyword function
there :)
For
Hello,
I am trying to build an editable ListCtrl_edit via TextEditMixin.
It displays o.k. and I can edit the first field with this is the code piece:
class VokabelListCtrl(wxListCtrl,
listmix.ListCtrlAutoWidthMixin,
listmix.TextEditMixin):
def
Sells, Fred wrote:
We are in the process of standardizing ~10 Linux servers on Lineox 4.x,
which is a variant of RedHat Enterprise server I'm told. Part of that
process is to standardize python.
The baseline install includes python 2.3 which is adequate, but I would like
to standardize on
Given a and b, two equal length lists of integers, I want c to be
[a1-b1, a2-b2, ... , an-bn]. I can do something like:
c = [0] * len(a)
for ndx, item in enumerate(a):
c[ndx] = item - b[ndx]
But I'm wondering if there's a better way, perhaps that avoids a loop?
Nick.
(I seem to recall
Terrance N. Phillip [EMAIL PROTECTED] writes:
Given a and b, two equal length lists of integers, I want c to be
[a1-b1, a2-b2, ... , an-bn].
c = [a[i] - b[i] for i in xrange(len(a))]
--
http://mail.python.org/mailman/listinfo/python-list
I assume some system tools must use them, even if I don't. I don't know if
I can just copy all this into the 2.4 site-packages (deleting .pyc and .pyo)
and get what I need.
Copying pure python site-packages from python23 to python24 should be
safe, but the binaries (.so) will not work because
Terrance N. Phillip wrote:
Given a and b, two equal length lists of integers, I want c to be
[a1-b1, a2-b2, ... , an-bn]. I can do something like:
c = [0] * len(a)
for ndx, item in enumerate(a):
c[ndx] = item - b[ndx]
But I'm wondering if there's a better way, perhaps that avoids a
Hello,
I propose 3 solutions. If someone have time to waste, he can make a
benchmark to know which is the fastest and give us the results on the
list.
Solution 1:
import itertools
c = [a_i-b_i for a_i, b_i in itertools.izip(a, b)]
Solution 2:
c = map(operator.sub, a, b)
#map will be removed
There are many ways to do this. None of them avoids looping,
technically, although you can easily avoid the for syntax.
-- Simple but wastes some memory
c = [i-j for i,j in zip(a,b)]
-- Using itertools.izip (python 2.3)
c = [i-j for i,j in itertools.izip(a,b) ]
-- Generator expression
Terrance N. Phillip wrote:
Given a and b, two equal length lists of integers, I want c to be
[a1-b1, a2-b2, ... , an-bn]. I can do something like:
c = [0] * len(a)
for ndx, item in enumerate(a):
c[ndx] = item - b[ndx]
But I'm wondering if there's a better way, perhaps that avoids a
If you use numarray, you *can* write
c = a-b
import numarray
a = numarray.array([1,2,3])
b = numarray.array([5,0,2])
c = a-b
c
array([-4, 2, 1])
numarray is packaged separately from Python.
http://www.stsci.edu/resources/software_hardware/numarray
Jeff
pgp25gtINPiqa.pgp
#map will be removed from the next versions of python.
The next version will be 2.5. Map will not go away then.
In 3.0, in the indefinite future, it might go away, it might just be moved.
tjr
--
http://mail.python.org/mailman/listinfo/python-list
Christopher Subich wrote:
In experimenting with this, I found a slight... fun issue involved in
this. Selection_get is the correct method to call, but it doesn't quite
work out of the box.
g.selection_get()
Traceback (most recent call last):
File stdin, line 1, in ?
File
1 - 100 of 131 matches
Mail list logo