Re: struct calcsize discrepency?

2011-12-05 Thread Mark Dickinson
On Dec 4, 3:17 pm, Chris Angelico wrote: > On Mon, Dec 5, 2011 at 1:51 AM, Dave Angel wrote: > > In C, the padding to the largest alignment occurs at the > > end of a structure as well as between items.  Otherwise, an array of the > > struct would not be safely aligned.  if you have an 8byte item

70% [* SPAM *] Re: multiprocessing.Queue blocks when sending large object

2011-12-05 Thread DPalao
El Martes Noviembre 29 2011, DPalao escribió: > Hello, > I'm trying to use multiprocessing to parallelize a code. There is a number > of tasks (usually 12) that can be run independently. Each task produces a > numpy array, and at the end, those arrays must be combined. > I implemented this using Qu

Re: Install Python on Windows without Start Menu icons?

2011-12-05 Thread Wolfgang Strobl
"Pedro Henrique G. Souto" : >On 02/12/2011 16:34, snorble wrote: >> Is it possible to automate the Python installation on Windows using >> the MSI file so it does not add a Start Menu folder? I would like to >> push out Python to all of my office workstations, but I'd like for it >> to be relative

Re: struct calcsize discrepency?

2011-12-05 Thread Chris Angelico
On Mon, Dec 5, 2011 at 6:42 PM, Mark Dickinson wrote: > That's a strange way to think of it, especially since the padding also > happens for a single struct object when there's no array present.  I > find it cleaner to think of C as having no padding in arrays, but > padding at the end of a struct

Can't install pycrypto

2011-12-05 Thread Alec Taylor
Good afternoon, Unfortunately my pycrpto install fails (tried with pip, easy_install and pip -e git+) Error: http://pastebin.com/wjjfTZvd How do I get this working? Thanks for all suggestions, Alec Taylor -- http://mail.python.org/mailman/listinfo/python-list

Re: struct calcsize discrepency?

2011-12-05 Thread Mark Dickinson
On Dec 5, 8:09 am, Chris Angelico wrote: > May be, yes, but since calcsize() is returning 12 when the elements > are put in the other order, it would seem to be not counting such > padding. Indeed. That's arguably a bug in the struct module, and one that people have had to find workarounds for i

Re: 70% [* SPAM *] Re: multiprocessing.Queue blocks when sending large object

2011-12-05 Thread boB
On Mon, 5 Dec 2011 09:02:08 +0100, DPalao wrote: >El Martes Noviembre 29 2011, DPalao escribió: >> Hello, >> I'm trying to use multiprocessing to parallelize a code. There is a number >> of tasks (usually 12) that can be run independently. Each task produces a >> numpy array, and at the end, thos

Spam in subject lines (Re: 70% [* SPAM *] Re: multiprocessing.Queue blocks when sending large object)

2011-12-05 Thread Chris Angelico
On Mon, Dec 5, 2011 at 7:57 PM, wrote: > Why do people add character  like    [* SPAM *]  to their  subject > lines ??   Is it supposed to do something  ??   I figured since > programmers hang out here, maybe one of you know this. People don't. It's something added by a spam filter that thought

Re: Spam in subject lines (Re: multiprocessing.Queue blocks when sending large object)

2011-12-05 Thread Steven D'Aprano
On Mon, 05 Dec 2011 20:11:28 +1100, Chris Angelico wrote: > On Mon, Dec 5, 2011 at 7:57 PM, wrote: >> Why do people add character  like    [* SPAM *]  to their  subject >> lines ??   Is it supposed to do something  ??   I figured since >> programmers hang out here, maybe one of you know this. >

Fwd: class print method...

2011-12-05 Thread Suresh Sharma
Pls help its really frustrating -- Forwarded message -- From: Suresh Sharma Date: Monday, December 5, 2011 Subject: class print method... To: "d...@davea.name" Dave, Thanx for the quick response, i am sorry that i did not explain correctly look at the code below inspite of this i

Re: class print method...

2011-12-05 Thread Chris Angelico
On Mon, Dec 5, 2011 at 10:18 PM, Suresh Sharma wrote: > > Suit=[aces,clubs,diamonds,hearts] > Rank=[2,3,4,5,6,7,8,9,j,Q,K,A] > class Card: > Def __init__(self,rannk,suiit): > Self.suiit=suiit > Self.rannk=rannk > > Def __str__(self): > Return suit[suiit],rank[rannk] > > Class deck: > Def __init__(

Re: order independent hash?

2011-12-05 Thread 88888 Dihedral
On Monday, December 5, 2011 1:50:08 PM UTC+8, Dan Stromberg wrote: > Two methods: > 1) If you need your hash only once in an infrequent while, then save > the elements in a list, appending as needed, and sort prior to > hashing, as needed > > 2) If you need your hash more often, you could keep you

Re: 70% [* SPAM *] multiprocessing.Queue blocks when sending large object

2011-12-05 Thread Lie Ryan
On 11/30/2011 06:09 AM, DPalao wrote: Hello, I'm trying to use multiprocessing to parallelize a code. There is a number of tasks (usually 12) that can be run independently. Each task produces a numpy array, and at the end, those arrays must be combined. I implemented this using Queues (multiproce

Re: Fwd: class print method...

2011-12-05 Thread Lie Ryan
On 12/05/2011 10:18 PM, Suresh Sharma wrote: Pls help its really frustrating -- Forwarded message -- From: Suresh Sharma Date: Monday, December 5, 2011 Subject: class print method... To: "d...@davea.name " mailto:d...@davea.name>> Dave, Thanx for the qui

Re: Install Python on Windows without Start Menu icons?

2011-12-05 Thread Lie Ryan
On 12/05/2011 07:01 PM, Wolfgang Strobl wrote: "Pedro Henrique G. Souto": On 02/12/2011 16:34, snorble wrote: Is it possible to automate the Python installation on Windows using the MSI file so it does not add a Start Menu folder? I would like to push out Python to all of my office workstation

Re: Fwd: class print method...

2011-12-05 Thread Dave Angel
On 12/05/2011 07:41 AM, Lie Ryan wrote: On 12/05/2011 10:18 PM, Suresh Sharma wrote: Pls help its really frustrating -- Forwarded message -- From: Suresh Sharma Date: Monday, December 5, 2011 Subject: class print method... To: "d...@davea.name " mailto:d.

Re: Can't install pycrypto

2011-12-05 Thread becky_lewis
My best guess from the error and a quick look at the setup.py file is that during setup "chmod 0755 configure" is trying to run but failing. I'm guessing that you're on windows and don't actually have chmod, hence the error. The project on github looks active so you could go and ask for a windows

How to install Python on Debian GNU/Linux (Python-2.7.2.tar.bz2)

2011-12-05 Thread patrickwayodi
Hi, How can I install Python on Debian GNU/Linux? I downloaded the file "Python-2.7.2.tar.bz2" but I don't know how to install it. Patrick. -- http://mail.python.org/mailman/listinfo/python-list

Re: How to install Python on Debian GNU/Linux (Python-2.7.2.tar.bz2)

2011-12-05 Thread Chris Angelico
On Tue, Dec 6, 2011 at 1:53 AM, patrickwayodi wrote: > Hi, > How can I install Python on Debian GNU/Linux? I downloaded the file > "Python-2.7.2.tar.bz2" but I don't know how to install it. You should actually already have Python installed. Try typing 'python' at a terminal and see if it invokes

Re: Install Python on Windows without Start Menu icons?

2011-12-05 Thread Brian Curtin
On Fri, Dec 2, 2011 at 12:34, snorble wrote: > Is it possible to automate the Python installation on Windows using > the MSI file so it does not add a Start Menu folder? I would like to > push out Python to all of my office workstations, but I'd like for it > to be relatively silent from the user

Re: How to install Python on Debian GNU/Linux (Python-2.7.2.tar.bz2)

2011-12-05 Thread patrickwayodi
> You should actually already have Python installed. Try typing 'python' > at a terminal and see if it invokes the interactive interpreter. > > ChrisA Yes, I have Python installed, but it's an old version. So I want to upgrade to "Python-2.7.2.tar.bz2". -- http://mail.python.org/mailman/listinf

Re: How to install Python on Debian GNU/Linux (Python-2.7.2.tar.bz2)

2011-12-05 Thread Chris Angelico
On Tue, Dec 6, 2011 at 2:40 AM, patrickwayodi wrote: >> You should actually already have Python installed. Try typing 'python' >> at a terminal and see if it invokes the interactive interpreter. >> >> ChrisA > > > Yes, I have Python installed, but it's an old version. So I want to > upgrade to "Py

Backspace does not erase in stdout

2011-12-05 Thread Steven D'Aprano
I have a function which reads characters from stdin and writes stars to stdout, but backspacing does not erase the stars as I expected. Tested in Python 2.6 on Linux. This will almost certainly not work on Windows. import sys, tty, termios def getpass(): fd = sys.stdin.fileno() old_sett

Re: Backspace does not erase in stdout

2011-12-05 Thread Chris Angelico
On Tue, Dec 6, 2011 at 3:09 AM, Steven D'Aprano wrote: > > Is there a way to erase the character other than backspacing, writing a > space, then backspacing again? That feels inelegant. Emitting "\b \b" is one very common way to do a destructive backspace. Inelegant? Perhaps, but a common inelega

Re: How to install Python on Debian GNU/Linux (Python-2.7.2.tar.bz2)

2011-12-05 Thread Steven D'Aprano
On Tue, 06 Dec 2011 02:51:21 +1100, Chris Angelico wrote: > On Tue, Dec 6, 2011 at 2:40 AM, patrickwayodi > wrote: >>> You should actually already have Python installed. Try typing 'python' >>> at a terminal and see if it invokes the interactive interpreter. >>> >>> ChrisA >> >> >> Yes, I have Py

Re: Backspace does not erase in stdout

2011-12-05 Thread Grant Edwards
On 2011-12-05, Chris Angelico wrote: > On Tue, Dec 6, 2011 at 3:09 AM, Steven D'Aprano > wrote: >> >> Is there a way to erase the character other than backspacing, writing a >> space, then backspacing again? That feels inelegant. > > Emitting "\b \b" is one very common way to do a destructive back

Re: How to install Python on Debian GNU/Linux (Python-2.7.2.tar.bz2)

2011-12-05 Thread Chris Angelico
On Tue, Dec 6, 2011 at 3:23 AM, Steven D'Aprano wrote: > Generally speaking, unless you are an expert, you should not use make > install when installing Python from source, because it will replace the > system Python with the newly installed one. > > Instead use `sudo make altinstall` Mea culpa,

Re: How to install Python on Debian GNU/Linux (Python-2.7.2.tar.bz2)

2011-12-05 Thread Christian Heimes
Am 05.12.2011 17:23, schrieb Steven D'Aprano: > The trickiest part for me is ensuring that tkinter works correctly. After > installing Python from source about a dozen times now, I still don't know > why sometimes it works and sometimes it doesn't. sudo apt-get build-dep python2.7 Done ;) Howe

Re: How to install Python on Debian GNU/Linux (Python-2.7.2.tar.bz2)

2011-12-05 Thread Christian Heimes
Am 05.12.2011 17:28, schrieb Chris Angelico: > On Tue, Dec 6, 2011 at 3:23 AM, Steven D'Aprano > wrote: >> Generally speaking, unless you are an expert, you should not use make >> install when installing Python from source, because it will replace the >> system Python with the newly installed one.

Re: Backspace does not erase in stdout

2011-12-05 Thread Steven D'Aprano
On Mon, 05 Dec 2011 16:23:55 +, Grant Edwards wrote: > On 2011-12-05, Chris Angelico wrote: >> On Tue, Dec 6, 2011 at 3:09 AM, Steven D'Aprano >> wrote: >>> >>> Is there a way to erase the character other than backspacing, writing >>> a space, then backspacing again? That feels inelegant. >>

Re: Backspace does not erase in stdout

2011-12-05 Thread Grant Edwards
On 2011-12-05, Steven D'Aprano wrote: > On Mon, 05 Dec 2011 16:23:55 +, Grant Edwards wrote: > >> On 2011-12-05, Chris Angelico wrote: >>> On Tue, Dec 6, 2011 at 3:09 AM, Steven D'Aprano >>> wrote: Is there a way to erase the character other than backspacing, writing a space, t

Scope of variable inside list comprehensions?

2011-12-05 Thread Roy Smith
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 guaranteed to be in scope in the print statement? I found one thread (

70% [* SPAM *] Re: Re: multiprocessing.Queue blocks when sending large object

2011-12-05 Thread DPalao
El Lunes Diciembre 5 2011, b...@mail.python.org escribió: > On Mon, 5 Dec 2011 09:02:08 +0100, DPalao > > wrote: > >El Martes Noviembre 29 2011, DPalao escribió: > >> Hello, > >> I'm trying to use multiprocessing to parallelize a code. There is a > >> number of tasks (usually 12) that can be run

Re: Scope of variable inside list comprehensions?

2011-12-05 Thread Jussi Piitulainen
Roy Smith writes: > 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 guaranteed to be in scope in the pri

Re: Scope of variable inside list comprehensions?

2011-12-05 Thread Chris Kaynor
On Mon, Dec 5, 2011 at 9:04 AM, Roy Smith 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 guaranteed

Re: Scope of variable inside list comprehensions?

2011-12-05 Thread Peter Otten
Roy Smith 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 guaranteed to be in scope in the prin

Pythonbrew is not installing Python 2.7 successfully

2011-12-05 Thread Patrick Wayodi
Hi, I'm trying to install Python 2.7 using Pythonbrew on a Debian GNU/Linux system, but I've failed. This is the output I got on my terminal: root@debian:~# pythonbrew install /home/guest/python27 Copying /home/guest/python27 into /root/.pythonbrew/build/Python-python27 This could take a while.

70% [* SPAM *] Re: multiprocessing.Queue blocks when sending large object

2011-12-05 Thread DPalao
Hi Lie, Thank you for the reply. El Lunes Diciembre 5 2011, Lie Ryan escribió: > On 11/30/2011 06:09 AM, DPalao wrote: > > Hello, > > I'm trying to use multiprocessing to parallelize a code. There is a > > number of tasks (usually 12) that can be run independently. Each task > > produces a numpy a

Re: LinuxJournal Readers' Choice Awards 2011 Best {Programming, Scripting} Language

2011-12-05 Thread Ron
Hello Wesley, Thanks for the interesting news from Linux Journal. Now, enquring minds want to know, when will there be a Core Python 3? Ron :-) -- http://mail.python.org/mailman/listinfo/python-list

Re: Scope of variable inside list comprehensions?

2011-12-05 Thread Jean-Michel Pichavant
Roy Smith 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 guaranteed to be in scope in the print statement? I

Re: Scope of variable inside list comprehensions?

2011-12-05 Thread Roy Smith
Hmmm, the use of id was just a simplification for the sake of posting. The real code is a bit more complicated and used a different variable name, but that's a good point. As far as storing the value in the exception, unfortunately, DoesNotExist is not my exception; it comes from deep within d

Re: Fwd: class print method...

2011-12-05 Thread Terry Reedy
On 12/5/2011 8:09 AM, Dave Angel wrote: useful, such as if you print a list. The __str__() method of list calls the __repr__() for each object inside it. So it can be useful to define both, even if you decide to have them do the same thing. If you want __str__ and __repr__ to do the same thing

Re: How to generate java .properties files in python

2011-12-05 Thread Serhiy Storchaka
03.12.11 23:34, Arnaud Delobelle написав(ла): Is there a simple way to achieve this? I could do something like this: def encode(u): """encode a unicode string in .properties format""" return u"".join(u"\\u%04x" % ord(c) if ord(c)> 0xFF else c for c in u).encode("latin_1") You must a

Re: Scope of variable inside list comprehensions?

2011-12-05 Thread Terry Reedy
On 12/5/2011 2:15 PM, Roy Smith wrote: Hmmm, the use of id was just a simplification for the sake of posting. The real code is a bit more complicated and used a different variable name, but that's a good point. As far as storing the value in the exception, unfortunately, DoesNotExist is not my

Re: How to generate java .properties files in python

2011-12-05 Thread Arnaud Delobelle
On 5 December 2011 20:05, Serhiy Storchaka wrote: > 03.12.11 23:34, Arnaud Delobelle написав(ла): > >> Is there a simple way to achieve this? I could do something like this: >> >> def encode(u): >>     """encode a unicode string in .properties format""" >>     return u"".join(u"\\u%04x" % ord(c) i

Re: Install Python on Windows without Start Menu icons?

2011-12-05 Thread snorble
On Dec 5, 2:01 am, Wolfgang Strobl wrote: > "Pedro Henrique G. Souto" : > > >On 02/12/2011 16:34, snorble wrote: > >> Is it possible to automate the Python installation on Windows using > >> the MSI file so it does not add a Start Menu folder? I would like to > >> push out Python to all of my offi

[ANNOUNCE] pypiserver 0.5.0 - minimal pypi server

2011-12-05 Thread Ralf Schmitt
Hi, I've just uploaded pypiserver 0.5.0 to the python package index. pypiserver is a minimal PyPI compatible server. It can be used to serve a set of packages and eggs to easy_install or pip. pypiserver is easy to install (i.e. just easy_install pypiserver). It doesn't have any external dependen

Re: How to generate java .properties files in python

2011-12-05 Thread Serhiy Storchaka
05.12.11 22:25, Arnaud Delobelle написав(ла): > On 5 December 2011 20:05, Serhiy Storchaka wrote: >> You must also encode backslash ('\\'), whitespaces and control characters >> (ord(c)<=32), '=' and ':' (key/value delimiters), '#' (comment) and '!'. > Fortunately there aren't any of these in the

Re: Backspace does not erase in stdout

2011-12-05 Thread Chris Angelico
On Tue, Dec 6, 2011 at 4:40 AM, Grant Edwards wrote: > After thinking a while, I do remember one program I ran across > recently that when you hit backspace would erase the entire line, then > rewrite the entire line stopping one character short of where it was > before.  Even at network speeds it

loop through arrays and find maximum

2011-12-05 Thread questions anon
I would like to calculate the max and min across many netcdf files. I know how to create one big array and then concatenate and find the numpy.max but when I run this on 1000's of arrays I have a memory error. What I would prefer is to loop through the arrays and produce the maximum without having

Re: Scope of variable inside list comprehensions?

2011-12-05 Thread Roy Smith
Well, in my defense, I did ask a pretty narrow question, "Is id guaranteed to be in scope in the print statement?". While I will admit that not knowing whether I could alter the exception, or whether id masked a builtin or not does complexify answering some questions, those are questions I didn

Re: Scope of variable inside list comprehensions?

2011-12-05 Thread Steven D'Aprano
On Mon, 05 Dec 2011 19:57:15 +0100, Jean-Michel Pichavant wrote: > The proper way to propagate information with exceptions is using the > exception itself: > > try: > songs = [Song(_id) for _id in song_ids] > except Song.DoesNotExist, exc: > print exc I'm not entirely sure that this is

Re: How to generate java .properties files in python

2011-12-05 Thread Arnaud Delobelle
On 5 December 2011 21:46, Serhiy Storchaka wrote: > 05.12.11 22:25, Arnaud Delobelle написав(ла): >> On 5 December 2011 20:05, Serhiy Storchaka  wrote: >>> You must also encode backslash ('\\'), whitespaces and control characters >>> (ord(c)<=32), '=' and ':' (key/value delimiters), '#' (comment)

Re: Scope of variable inside list comprehensions?

2011-12-05 Thread Roy Smith
Sigh. I attempted to reduce this to a minimal example to focus the discussion on the question of list comprehension variable scope. Instead I seem to have gotten people off on other tangents. I suppose I should post more of the real code... song_ids = request.POST.getlist('song_id')

Re: order independent hash?

2011-12-05 Thread Dan Stromberg
On 12/5/11, 8 Dihedral wrote: > On Monday, December 5, 2011 1:50:08 PM UTC+8, Dan Stromberg wrote: >> Two methods: >> 1) If you need your hash only once in an infrequent while, then save >> the elements in a list, appending as needed, and sort prior to >> hashing, as needed >> >> 2) If you nee

Re: Scope of variable inside list comprehensions?

2011-12-05 Thread Terry Reedy
On 12/5/2011 5:36 PM, Roy Smith wrote: Well, in my defense, I did ask a pretty narrow question, "Is id guaranteed to be in scope in the print statement?". Yes for 2.x, guaranteed no for 3.x. If you had simply asked "Is the loop variable of a list comprehension guaranteed to be in scope after

Re: Scope of variable inside list comprehensions?

2011-12-05 Thread Chris Angelico
On Tue, Dec 6, 2011 at 9:57 AM, Roy Smith wrote: > I may be in the minority here, but it doesn't bother me much that my use of > 'id' shadows a built-in.  Especially in small scopes like this, I use > whatever variable names make the the code easiest to read and don't worry > about shadowing bu

Re: Questions about LISP and Python.

2011-12-05 Thread Xah Lee
On Dec 5, 4:31 am, Tim Bradshaw wrote: > On 2011-12-05 11:51:11 +, Xah Lee said: > > > python has more readible syntax, more modern computer language > > concepts, and more robust libraries. These qualities in turn made it > > popular. > > Yet you still post here: why? i don't like python, an

Re: Questions about LISP and Python.

2011-12-05 Thread Chris Angelico
On Tue, Dec 6, 2011 at 3:36 PM, Xah Lee wrote: > i don't like python, and i prefer emacs lisp. The primary reason is > that python is not functional, especially with python 3. The python > community is full of fanatics with their drivels. In that respect, > it's not unlike Common Lisp community an

Single key press

2011-12-05 Thread Sergi Pasoev
Hi. I wonder if it is realistic to get a single key press in Python without ncurses or any similar library. In single key press I mean something like j and k in Gnu less program, you press the key and and it is captured by the script without need to press enter afterwards -- http://mail.python.or

Re: Fwd: class print method...

2011-12-05 Thread Suresh Sharma
Dave / Ryan Thanks i have got it and it worked after using repr statement. Thanks everyone for their valuable feedback. On Mon, Dec 5, 2011 at 6:11 PM, Lie Ryan wrote: > On 12/05/2011 10:18 PM, Suresh Sharma wrote: > >> >> Pls help its really frustrating >> -- Forwarded message ---

Re: Single key press

2011-12-05 Thread 88888 Dihedral
On Tuesday, December 6, 2011 1:49:55 PM UTC+8, Sergi Pasoev wrote: > Hi. > > I wonder if it is realistic to get a single key press in Python > without ncurses or > any similar library. In single key press I mean something like j and k > in Gnu less > program, you press the key and and it is captur

Re: Scope of variable inside list comprehensions?

2011-12-05 Thread Rainer Grimm
Hello, > try: > songs = [Song(id) for id in song_ids] > except Song.DoesNotExist: > print "unknown song id (%d)" % id that's is a bad programming style. So it will be forbidden with python 3. The reason is that list comprehension is a construct from the functional world.

Re: Questions about LISP and Python.

2011-12-05 Thread alex23
On Dec 6, 2:36 pm, Xah Lee wrote: > The python community is full of fanatics with their drivels. You do know that you could just fuck right off and leave us to it, yes? In general, it's the person who is shrilly imposing their minority opinion on a disinterested audience that deserves the title

Re: Questions about LISP and Python.

2011-12-05 Thread Matt Joiner
This guy is an even better troll than that 8 guy. His spelling is equally bad. His essays make some good points, but I don't see why he doesn't shut his trap and move on. ಠ_ಠ On Tue, Dec 6, 2011 at 6:02 PM, alex23 wrote: > On Dec 6, 2:36 pm, Xah Lee wrote: >> The python community is full