On Dec 6, 7:30 pm, John Ladasky wrote:
> On Dec 6, 1:42 pm, Terry Reedy wrote:
> > It is even possible that multiprocessing.pool has a bug
> > that you ran into.
>
> Oh, please don't say that. I'm no computer scientist, and
> Python has been scrutinized by so many professionals. I
> couldn't ha
On Wed, Dec 7, 2011 at 5:57 PM, Steven D'Aprano
wrote:
> On Tue, 06 Dec 2011 16:30:16 -0800, John Ladasky wrote:
>
>> Oh, please don't say that. I'm no computer scientist, and Python has
>> been scrutinized by so many professionals. I couldn't have possibly
>> found a language bug.
>
> While you
On Tue, 06 Dec 2011 16:30:16 -0800, John Ladasky wrote:
>> I would start with the line that fails 'put(task)', and work backwards
>> to see where 'task' comes from and how it could become None. It is even
>> possible that multiprocessing.pool has a bug that you ran into.
>
> Oh, please don't say
On 12/6/11, Steven D'Aprano wrote:
> I have some bit-twiddling code written in Java which I am trying to port
> to Python.:
>
> long newSeed = (seed & 0xL) * 0x41A7L;
> while (newSeed >= 0x8000L) {
> newSeed = (newSeed & 0x7FFFL) + (newSeed >>> 31L);
> }
> seed = (newSeed =
On Monday, December 5, 2011 7:24:49 AM UTC+8, Ian wrote:
> On Sun, Dec 4, 2011 at 4:17 PM, 8 Dihedral
> wrote:
> >> Please explain what you think a hash function is, then. Per
> >> Wikipedia, "A hash function is any algorithm or subroutine that maps
> >> large data sets to smaller data sets,
I have some bit-twiddling code written in Java which I am trying to port
to Python. I'm not getting the same results though, and I think the
problem is due to differences between Java's signed byte/int/long types,
and Python's unified long integer type. E.g. Java's >>> is not exactly
the same a
On Tue, 06 Dec 2011 22:04:36 +0430, Sergi Pasoev wrote:
> Thanks Steven. Maybe you mean Gnu/Linux when you say Linux.
Maybe I do, maybe I don't. Since you're replying to a digest and neither
adjusted the subject line nor trimmed almost a dozen pages of unnecessary
quoted text, I have no idea wh
On 12/6/2011 7:30 PM, John Ladasky wrote:
On Dec 6, 1:42 pm, Terry Reedy wrote:
On 12/6/2011 2:13 PM, John Ladasky wrote:
I need to
accomplish this WITHOUT adding a try...except block to the Python
library file multiprocessing/pool.py.
I do not understand this statement. You should feel fr
On Dec 6, 1:42 pm, Terry Reedy wrote:
> On 12/6/2011 2:13 PM, John Ladasky wrote:
> > Exception in thread Thread-1:
> > Traceback (most recent call last):
> > File "/usr/lib/python2.6/threading.py", line 532, in
> > __bootstrap_inner
> > self.run()
> > File "/usr/lib/python2.6/threading
John I'm in a similar position. I've been using Geany for 2+ years and
haven't found anything to replace it.
Either the replacement tool makes it too difficult to work with Python
correctly, or I spend more time trying to understand it, rather than
getting the job done.
I also use vim on occasion w
Thanks, Marco.
I've noticed that the matplotlib reference manual recommends ipython.
I haven't been clear what its advantages are, but if interacting with
multiprocessing correctly is one of them, I'll try it.
If ipython does everything that IDLE does and more, why is IDLE still
shipped with Pyth
On Nov 30, Irmen de Jong opened a tracker issue with a patch improve
bytearray pickling.
http://bugs.python.org/issue13503
Yesterday, Dec 5, Antoine Pitrou applied a revised fix.
http://hg.python.org/cpython/rev/e2959a6a1440/
The commit message:
"Issue #13503: Use a more efficient reduction form
On Wed, Dec 7, 2011 at 9:11 AM, Terry Reedy wrote:
> Cute. I am used to linked lists being built from the bottem up in functional
> languages with immutable nodes. I might even use something like this. Of
> course, for a list of any length, walk needs to be iterative.
>
> def walk(self):
>
On 12/6/2011 7:33 AM, Chris Angelico wrote:
On Tue, Dec 6, 2011 at 11:20 PM, Terry Reedy wrote:
You found an unsafe overlap.
x.thing = x = 1
would work, though it seems strange (and unlikely in practice) to rebind x
to an int after it is bound to a class k instance.
This code is starting to l
On 12/6/2011 2:13 PM, John Ladasky wrote:
Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python2.6/threading.py", line 532, in
__bootstrap_inner
self.run()
File "/usr/lib/python2.6/threading.py", line 484, in run
self.__target(*self.__args, **self
On Dec 6, 8:13 pm, John Ladasky wrote:
> Hi, folks,
>
> Back in 2002, I got back into programming after a nine-year hiatus. I
> needed a new programming language, was guided to Python 2.2, and was
> off to the races. I chose the SciTE program editor, and I have been
> using it ever since. I'm n
On 12/6/11 7:27 PM, John Ladasky wrote:
On a related note, pickling of arrays of float64 objects, as generated
by the numpy package for example, are wildly inefficient with memory.
A half-million float64's requires about 4 megabytes, but the pickle
file I generated from a numpy.ndarray of this si
On 06-12-11 20:27, John Ladasky wrote:
On a related note, pickling of arrays of float64 objects, as generated
by the numpy package for example, are wildly inefficient with memory.
A half-million float64's requires about 4 megabytes, but the pickle
file I generated from a numpy.ndarray of this siz
On Dec 1, 12:21 am, Chris Angelico wrote:
> On Thu, Dec 1, 2011 at 2:15 PM, Roy Smith wrote:
> That's a self-contained piece of code.If I came upon it, I'd probably
> copy and paste it to IDLE, see what it comes up with, and proceed from
> there.
+1. That was going to be my comment exactly.
-
On Dec 6, 5:29 pm, Matt Saxton wrote:
> You can use a metaclass for this:
>
> >>> class BaseMeta(type):
> ... def __new__(mcs, name, bases, dict):
> ... dict['key'] = 'Key_for_%s' % name
> ... return type.__new__(mcs, name, bases, dict)
> ...
> >>> class Base:
> ... __met
On a related note, pickling of arrays of float64 objects, as generated
by the numpy package for example, are wildly inefficient with memory.
A half-million float64's requires about 4 megabytes, but the pickle
file I generated from a numpy.ndarray of this size was 42 megabytes.
I know that numpy ha
Hi, folks,
Back in 2002, I got back into programming after a nine-year hiatus. I
needed a new programming language, was guided to Python 2.2, and was
off to the races. I chose the SciTE program editor, and I have been
using it ever since. I'm now using Python 2.6 on Ubuntu Linux 10.10.
My prog
On 6 December 2011 18:12, Ian Kelly wrote:
> How about a class property?
>
> class classproperty(object):
> def __init__(self, fget):
> self.__fget = fget
> def __get__(self, instance, owner):
> return self.__fget(owner)
Nice :-) About as heavyweight as a classmethod, though,
12/06/11 11:34, Sergi Pasoev wrote:
(after trimming all the digest rubbish the way you should have
done in the first place)
Coincidentally, I was working on that exact function last
night, so you inspired me to put it up on the Python
cookbook. This version should work on any POSIX system such
as
On Tue, Dec 6, 2011 at 11:12 AM, Ian Kelly wrote:
> If you like, you can also expand classproperty to allow setters and
> deleters like property does.
My mistake, you can't do this. __set__ and __delete__ are only
invoked on instances, not on the class. Get-only class properties are
fine, thoug
On Tue, Dec 6, 2011 at 8:57 AM, Paul Moore wrote:
> I want to set up an inheritance hierarchy. The base class will define
> a string value which should include the class name, but I don't want
> people who inherit from my class to have to remember to override the
> value.
>
> If I do this using a
Yes indeed, use the newer version. I thought this problem was already solved,
Python 3 has already been there for long enough time.
--
http://mail.python.org/mailman/listinfo/python-list
On 06/12/11 15:57, Paul Moore wrote:
I want to set up an inheritance hierarchy. The base class will define
a string value which should include the class name, but I don't want
people who inherit from my class to have to remember to override the
value.
If I do this using an instance variable, it'
What is the opinion of the wizards here, shall I learm Python 2 or
Python 3? I'm posting this here because I feel that this point is
interesting to other students of Python.
Use the newer version and don't look back.
--
http://mail.python.org/mailman/listinfo/python-list
Thanks Steven. Maybe you mean Gnu/Linux when you say Linux.
2011/12/6 :
> Send Python-list mailing list submissions to
> python-list@python.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
> http://mail.python.org/mailman/listinfo/python-list
> or, via email, send a
On Tue, Dec 6, 2011 at 6:13 AM, Rick Johnson
wrote:
> I would say Mr. Lee does in fact find some usefulness of Python (as do
> i) HOWEVER he also laments the asinities that plague the language, the
> documentation, and especially, this community.
>
> Anyone who would take the time to write *articu
I want to set up an inheritance hierarchy. The base class will define
a string value which should include the class name, but I don't want
people who inherit from my class to have to remember to override the
value.
If I do this using an instance variable, it's reasonably easy:
>>> class Base:
...
On Tuesday, December 6, 2011 11:22:18 PM UTC+8, Grant Edwards wrote:
> On 2011-12-06, Sergi Pasoev wrote:
>
> > I wonder if it is realistic to get a single key press in Python
> > without ncurses or
> > any similar library.
>
> Yes. Just put the tty associated with stdin in raw mode and make
>
On 2011-12-06, Nobody wrote:
> On Mon, 05 Dec 2011 16:23:55 +, Grant Edwards wrote:
>
>>> Emitting "\b \b" is one very common way to do a destructive backspace.
>>> Inelegant? Perhaps, but a common inelegance.
>>
>> That's pretty much the only way I've seen it done for the past 25
>> years.
>
On 2011-12-06, Sergi Pasoev wrote:
> I wonder if it is realistic to get a single key press in Python
> without ncurses or
> any similar library.
Yes. Just put the tty associated with stdin in raw mode and make
single byte read() calls on it. Remember to restore the tty settings
when your progra
In article
,
Rick Johnson wrote:
> *Wise Observer Speculates:* Why on earth are we "21st century slaves"
> to an archaic mid 20th century technology that punches holes in paper
> tape? Anyone?
Or to an archaic mid 20th century technology that limited lines to 80
characters?
--
http://mail.py
In article ,
Nobody wrote:
> On Mon, 05 Dec 2011 16:23:55 +, Grant Edwards wrote:
>
> >> Emitting "\b \b" is one very common way to do a destructive backspace.
> >> Inelegant? Perhaps, but a common inelegance.
> >
> > That's pretty much the only way I've seen it done for the past 25
> > ye
I'd like to build a 64-bit version of Python on Solaris using gcc. I did a
bit of Googling, but everything I came up with seemed old, inconclusive or
assumes the use of the Sun Studio compiler, with which i have no
experience. Does anyone have a recipe for the subject build?
Thanks,
--
Skip M
What about named pipes? I don't mind a bit of "if Windows do this, else,
do that" as long I'm not coding two or more completely different
approaches. I'm not too familiar with named pipes, though; perhaps
someone with some experience could chime in.
Apparently this didn't go through to Google Gro
On Wed, Dec 7, 2011 at 12:21 AM, Rick Johnson
wrote:
> *Wise Observer Speculates:* Why on earth are we "21st century slaves"
> to an archaic mid 20th century technology that punches holes in paper
> tape? Anyone?
>
isinstance(Progress, None)
> True
I'm not sure. Let's see...
* Manned, power
On Dec 6, 3:27 am, Nobody wrote:
> On Mon, 05 Dec 2011 16:23:55 +, Grant Edwards wrote:
> >> Emitting "\b \b" is one very common way to do a destructive backspace.
> >> Inelegant? Perhaps, but a common inelegance.
>
> > That's pretty much the only way I've seen it done for the past 25
> > year
I'm surprised no one has mentioned zeromq as transport yet. It provides
scaling from in proc (between threads) to inter-process and remote machines in
a fairly transparent way. It's obviously not the python stdlib and as any
system there are downsides too.
Regards,
Floris
--
http://mail.pyth
On Wed, Dec 7, 2011 at 12:13 AM, Rick Johnson
wrote:
> This community is chalk full (from top to bottom!) of arrogant, tech
> geeking, unix hacks who look down on the "outsiders" as excrement. I
> believe it's high time for these folks to eat a big slice of humble
> pie -- i just fear there is not
So apparently PythonTidy uses the AST (the compiler module) to find out
the problems,
and generates new nodes with a put method to write out the code with the
fix.
An awful lot of code is needed to make it work apparently, not very neat.
Pep8 instead uses tokenize and regular expressions only,
On Dec 5, 11:10 pm, Chris Angelico wrote:
> 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
On 12/06/2011 12:17 PM, Pedro Henrique G. Souto wrote:
Something like PythonTidy does what you want?
http://pypi.python.org/pypi/PythonTidy
If you like to write your own script, or if what you want is similar,
but not the same, the source code is a good place to start:
http://lacusveris.com
On Tue, Dec 6, 2011 at 11:20 PM, Terry Reedy wrote:
> You found an unsafe overlap.
> x.thing = x = 1
> would work, though it seems strange (and unlikely in practice) to rebind x
> to an int after it is bound to a class k instance.
This code is starting to look like it wants to work with a linked
On 12/6/2011 6:06 AM, Yingjie Lan wrote:
Hi, I just figured out this with Python3.2 IDLE:
class k: pass
x=k()
x.thing = 1
x.thing
1
x = x.thing = 1
Traceback (most recent call last):
File "", line 1, in
x = x.thing = 1
AttributeError: 'int' object has no attribute 'thing'
x
1
=
On 06/12/2011 10:06, Chris Angelico wrote:
On Tue, Dec 6, 2011 at 10:59 PM, Andrea Crotti
wrote:
Well it's not so simple, I clearly don't want to strip out whitespace in the
beginning of the line,
or my nice code will break miserably ;)
The question is: What is "wrong" whitespace? Whatever y
On Tue, Dec 6, 2011 at 10:59 PM, Andrea Crotti
wrote:
> Well it's not so simple, I clearly don't want to strip out whitespace in the
> beginning of the line,
> or my nice code will break miserably ;)
The question is: What is "wrong" whitespace? Whatever you declare to
be wrong, you can probably c
On 12/06/2011 11:49 AM, Pedro Henrique G. Souto wrote:
On 06/12/2011 09:28, Andrea Crotti wrote:
> Now on Emacs I have a hook before every save that cleans up all the
> "wrong" white spaces,
> with the 'whitespace-cleanup' function.
>
> I would like that also for my non emacsers colleagues, and p
On 06/12/2011 09:28, Andrea Crotti wrote:
> Now on Emacs I have a hook before every save that cleans up all the
> "wrong" white spaces,
> with the 'whitespace-cleanup' function.
>
> I would like that also for my non emacsers colleagues, and possibly with
> a Python script.
> I looked up around but
Now on Emacs I have a hook before every save that cleans up all the
"wrong" white spaces,
with the 'whitespace-cleanup' function.
I would like that also for my non emacsers colleagues, and possibly with
a Python script.
I looked up around but I can't find anything useful, any advice?
Thanks,
And
Hi, I just figured out this with Python3.2 IDLE:
>>> class k: pass
>>> x=k()
>>> x.thing = 1
>>> x.thing
1
>>> x = x.thing = 1
Traceback (most recent call last):
File "", line 1, in
x = x.thing = 1
AttributeError: 'int' object has no attribute 'thing'
>>> x
1
>>>
when I do
Steven D'Aprano wrote:
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 entire
On Tuesday, December 6, 2011 2:42:35 PM UTC+8, Rainer Grimm wrote:
> 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. T
On Tue, 06 Dec 2011 10:19:55 +0430, Sergi Pasoev wrote:
> I wonder if it is realistic to get a single key press in Python
> without ncurses or any similar library.
On Unix, you need to use termios.tcsetattr() to disable "canonical mode".
Otherwise, the tty driver will only pass data up to the app
On 6/12/11 09:48:39, Steven D'Aprano wrote:
On Tue, 06 Dec 2011 10:19:55 +0430, 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 k
On Mon, 05 Dec 2011 16:23:55 +, Grant Edwards wrote:
>> Emitting "\b \b" is one very common way to do a destructive backspace.
>> Inelegant? Perhaps, but a common inelegance.
>
> That's pretty much the only way I've seen it done for the past 25
> years.
... before which, it was BS-DEL-BS.
D
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 and Scheme lisp community.
What functional programming
On Mon, 05 Dec 2011 00:20:32 -0800, Mark Dickinson 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,
There's no "arguably" about i
On Tue, 06 Dec 2011 10:19:55 +0430, 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 captured by the
On Dec 6, 3:49 pm, Sergi Pasoev wrote:
> I wonder if it is realistic to get a single key press in Python
> without ncurses or any similar library.
It's possible using Tkinter in the standard library:
http://www.daniweb.com/software-development/python/code/216830
--
http://mail.python.org/mailm
I do not want GUI, I just want a console application which will read a
single character
input. When you read from stdin for example, you have it to be terminated.
2011/12/6 :
> Send Python-list mailing list submissions to
> python-list@python.org
>
> To subscribe or unsubscribe via the Wor
64 matches
Mail list logo