Tuesday, March 2, 2010

comp.lang.python - 25 new messages in 13 topics - digest

comp.lang.python
http://groups.google.com/group/comp.lang.python?hl=en

comp.lang.python@googlegroups.com

Today's topics:

* Docstrings considered too complicated - 8 messages, 6 authors
http://groups.google.com/group/comp.lang.python/t/dea5c94f3d058e26?hl=en
* Queue peek? - 3 messages, 3 authors
http://groups.google.com/group/comp.lang.python/t/ba3cb62c81d4cb7a?hl=en
* Method / Functions - What are the differences? - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/72ab93ba395822ed?hl=en
* cpan for python? - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/ecd51ced8d24593e?hl=en
* Broken references in postings - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/658a7033105e20f3?hl=en
* Is this secure? - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/ffff2b290db4e811?hl=en
* Email Script - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/76c43e013743795b?hl=en
* Multiprocessing problem - 2 messages, 2 authors
http://groups.google.com/group/comp.lang.python/t/3909e9c08cc8efe1?hl=en
* Draft PEP on RSON configuration file format - 2 messages, 2 authors
http://groups.google.com/group/comp.lang.python/t/09ce33197b330e90?hl=en
* os.fdopen() issue in Python 3.1? - 2 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/49a2ca4c1f9e7a59?hl=en
* UNA VETRINA SUL MONDO - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/fffb1509044f49ef?hl=en
* Image.frombuffer and warning - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/ee441d531cec25fe?hl=en
* python 2.6: how to modify a PIL image from C without copying forth and back -
1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/c456d88ea2773a7e?hl=en

==============================================================================
TOPIC: Docstrings considered too complicated
http://groups.google.com/group/comp.lang.python/t/dea5c94f3d058e26?hl=en
==============================================================================

== 1 of 8 ==
Date: Tues, Mar 2 2010 1:51 pm
From: Andreas Waldenburger


On Tue, 02 Mar 2010 19:05:25 +0100 Jean-Michel Pichavant
<jeanmichel@sequans.com> wrote:

> Andreas Waldenburger wrote:
> >
> > I had hoped that everyone just read it, went like "Oh geez.",
> > smiled it off with a hint of lesson learned and got back to
> > whatever it was they were doing. Alas, I was wrong ... and I'm
> > sorry.
> >
> There's something wrong saying that stupid people write working code
> that totally satisfies your needs. Don't you agree ? ;-)
>
No, in fact I don't.

It works. They are supposed to make it work. And that's what they do.
Whether or not they put their docstrings in the place they should does
not change that their code works.

Sorry, you guys drained all the funny out of me.

/W

--
INVALID? DE!

== 2 of 8 ==
Date: Tues, Mar 2 2010 2:19 pm
From: Andreas Waldenburger


On Wed, 03 Mar 2010 08:22:40 +1100 Ben Finney
<ben+python@benfinney.id.au> wrote:

> Andreas Waldenburger <usenot@geekmail.INVALID> writes:
>
> > Don't get me wrong; our whole system is more fragile than I find
> > comfortable. But I guess getting 10ish different parties around the
> > globe to work in complete unison is quite a feat, and I'm surprised
> > it even works as it is. But it does, and I'm glad we don't have to
> > micromanage other people's code.
>
> It's rather odd that you think of "require general quality standards,
> independently measurable and testable" to be "micromanaging".
>
I should know better than to argue these things, but I don't. Hmph.

We demand testable quality standards, but not of their code. We demand
it of their software. We say *what* we want, they decide *how* they'll
do it. Noncompliance will be fined, by a contractually agreed
amount. Everything beyond that is micromanaging and detracts workforce
from the stuff *we* have to do.

We are in exactly the same kind of bond with a company that buys our
system (and support). I have yet to see any one of them demand to see
how we write our code. Why should they care? (Rhetorical question, I
refuse to discuss this any further.)


> I guess that when even the *customers* will resist implementing such
> quality expectations, it's little surprise that the vendors continue
> to push out such shoddy work on their customers.
>
When I'm building bicycles I can go to the trouble of going by what
method of galvanization my tires are produced. Or I save myself the
trouble and just take the best offer and hold them responsible when
they don't deliver on their promise. Both possible, both work, and both
appropriate in certain situations.

You can keep discussing if you want, I've said more than I was hoping
to.

/W


--
INVALID? DE!

== 3 of 8 ==
Date: Tues, Mar 2 2010 2:38 pm
From: Albert van der Horst


In article <hm9cbc$9p4$1@speranza.aioe.org>, Mel <mwilson@the-wire.com> wrote:
>Jean-Michel Pichavant wrote:
>> Andreas Waldenburger wrote:
>>> On Fri, 26 Feb 2010 09:09:36 -0600 Tim Daneliuk <tundra@tundraware.com>
>>> wrote:
>>>> Reminiscent of:
>>>> mov AX,BX ; Move the contents of BX into AX
>
>>> Well, there might be some confusion there as to what gets moved where,
>>> wouldn't you say? I guess this goes away after a couple of months,
>>> though.
>
>> I agree to that statement, I was surprised that mov AX,BX assumes that
>> BX is the source, and AX the destination. I never programmed in
>> assembler though.
>
>You could think of it as a not bad use of the design principle "Clear The
>Simple Stuff Out Of The Way First". Destinations are commonly a lot simpler
>than sources -- just as in Python assignment statements. So you can tell
>more or less at a glance what's going to be changed, then get into the deep
>analysis to find what it's going to be changed to.

The real background is that a very long time ago at Intel
the first guy that wrote an assembler, got it "wrong", i.e.
violated the conventions established already at the time.

No nothing clever, nothing conscious, just reinventing the wheel
badly.

Next time you tell me that the MSDOS "file" system was well thought
out :-)

> Mel.

Groetjes Albert

--
--
Albert van der Horst, UTRECHT,THE NETHERLANDS
Economic growth -- being exponential -- ultimately falters.
albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst

== 4 of 8 ==
Date: Tues, Mar 2 2010 3:01 pm
From: aahz@pythoncraft.com (Aahz)


In article <20100302225156.67171851@geekmail.INVALID>,
Andreas Waldenburger <usenot@geekmail.INVALID> wrote:
>
>Sorry, you guys drained all the funny out of me.

Don't let a few nitpickers do that! I thought it was funny; after that,
just remember that every Usenet thread drifts away from *your* point.
--
Aahz (aahz@pythoncraft.com) <*> http://www.pythoncraft.com/

"Many customs in this life persist because they ease friction and promote
productivity as a result of universal agreement, and whether they are
precisely the optimal choices is much less important." --Henry Spencer


== 5 of 8 ==
Date: Tues, Mar 2 2010 3:12 pm
From: Grant Edwards


On 2010-03-02, Albert van der Horst <albert@spenarnc.xs4all.nl> wrote:

> No nothing clever, nothing conscious, just reinventing the wheel
> badly.
>
> Next time you tell me that the MSDOS "file" system was well thought
> out :-)

Just a mediocre copy of the CP/M filesystem, which was in turn
copied from DEC's RSTS or RSX.

--
Grant Edwards grant.b.edwards Yow! Kids, don't gross me
at off ... "Adventures with
gmail.com MENTAL HYGIENE" can be
carried too FAR!


== 6 of 8 ==
Date: Tues, Mar 2 2010 3:32 pm
From: Steven D'Aprano


On Tue, 02 Mar 2010 22:51:56 +0100, Andreas Waldenburger wrote:

> On Tue, 02 Mar 2010 19:05:25 +0100 Jean-Michel Pichavant
> <jeanmichel@sequans.com> wrote:
>
>> Andreas Waldenburger wrote:
>> >
>> > I had hoped that everyone just read it, went like "Oh geez.", smiled
>> > it off with a hint of lesson learned and got back to whatever it was
>> > they were doing. Alas, I was wrong ... and I'm sorry.
>> >
>> There's something wrong saying that stupid people write working code
>> that totally satisfies your needs. Don't you agree ? ;-)
>>
> No, in fact I don't.
>
> It works. They are supposed to make it work. And that's what they do.
> Whether or not they put their docstrings in the place they should does
> not change that their code works.
>
> Sorry, you guys drained all the funny out of me.

Most of the customers I've worked for have insisted we follow best
practices. Sometimes they even invent their own best practices that
nobody has even heard of, and that's fun (not). You're the first one I've
ever met that bitches publicly that your contractors don't follow best
practice, but objects strenuously to the idea that you are right to care
about that they don't.

Wow. Just... wow.

P.S. next time you want some not-quite-best-practice Python code written,
send me an email off-list. I'll be more than happy to do not-quite-best-
practice work for you.

*wink*

--
Steven


== 7 of 8 ==
Date: Tues, Mar 2 2010 3:34 pm
From: Steven D'Aprano


On Tue, 02 Mar 2010 23:19:09 +0100, Andreas Waldenburger wrote:

> We demand testable quality standards, but not of their code. We demand
> it of their software. We say *what* we want, they decide *how* they'll
> do it. Noncompliance will be fined, by a contractually agreed amount.
> Everything beyond that is micromanaging and detracts workforce from the
> stuff *we* have to do.

You specify the Functional Requirements but not the Design Requirements.
Fair enough.


> We are in exactly the same kind of bond with a company that buys our
> system (and support). I have yet to see any one of them demand to see
> how we write our code. Why should they care? (Rhetorical question, I
> refuse to discuss this any further.)

It is true that most people don't care how code is written. But they
*should* care, because how it is written directly impacts the quality of
the code. Saying "I don't care how it is written" is precisely the same
as saying "I don't care how reliable, secure or efficient the code is".

Of course people do this. People also inhale carcinogenic chemicals, vote
bad laws into place, drive too fast, ingest noxious chemicals, and spend
hours on Usenet debating the number of angels that can dance on the head
of a pin.


>> I guess that when even the *customers* will resist implementing such
>> quality expectations, it's little surprise that the vendors continue to
>> push out such shoddy work on their customers.
>>
> When I'm building bicycles I can go to the trouble of going by what
> method of galvanization my tires are produced. Or I save myself the
> trouble and just take the best offer and hold them responsible when they
> don't deliver on their promise. Both possible, both work, and both
> appropriate in certain situations.

Many years ago, I assisted a professional building architect design a
software system for specifying the requirements of major architectural
works such as bridges and high-rise buildings. They specify *everything*,
right down to the type of sand used in the concrete and the grade of
steel used for the frame. When using the wrong type of sand could mean
that the bridge collapses in 35 years, you soon learn that, yes, you damn
well better care.

--
Steven


== 8 of 8 ==
Date: Tues, Mar 2 2010 3:42 pm
From: Ben Finney


Andreas Waldenburger <usenot@geekmail.INVALID> writes:

> It works. They are supposed to make it work. And that's what they do.
> Whether or not they put their docstrings in the place they should does
> not change that their code works.

No-one has been denying that.

What the quality of their source code *does* affect, though, is its
maintainability over time – especially in the inevitable event that the
relationship with you as their customer comes to an end.

The arguments I've seen here in this sub-thread have been in favour of
customers demanding that the code meets functional requirements *and*
soruce code quality requirements.

Just as customers should demand both that a building be built to do its
job well, *and* that its architectural plans meet measurable, testable
industry standards of quality for independent re-use at some
indeterminate later date.

If we don't demand such things as customers of program developers, we
deserve what programs we get.

--
\ "Special today: no ice cream." —mountain inn, Switzerland |
`\ |
_o__) |
Ben Finney

==============================================================================
TOPIC: Queue peek?
http://groups.google.com/group/comp.lang.python/t/ba3cb62c81d4cb7a?hl=en
==============================================================================

== 1 of 3 ==
Date: Tues, Mar 2 2010 1:54 pm
From: mk


Daniel Stutzbach wrote:
> On Tue, Mar 2, 2010 at 1:58 PM, Martin P. Hellwig
> <martin.hellwig@dcuktec.org <mailto:martin.hellwig@dcuktec.org>> wrote:
>
> What actually happens if multiple threads at the same time, write to
> a shared dictionary (Not using the same key)?

> All of Python's built-in types are thread safe. Both updates will happen.

No need to use synchro primitives like locks?

I know that it may work, but that strikes me as somehow wrong... I'm
used to using things like Lock().acquire() and Lock().release() when
accessing shared data structures, whatever they are.

Although trying to do the "right thing" may indeed get one in trouble in
case of deadlock caused by a bug in one's own program.

Regards,
mk


== 2 of 3 ==
Date: Tues, Mar 2 2010 2:08 pm
From: John Krukoff


On Tue, 2010-03-02 at 22:54 +0100, mk wrote:
<snip>
> No need to use synchro primitives like locks?
>
> I know that it may work, but that strikes me as somehow wrong... I'm
> used to using things like Lock().acquire() and Lock().release() when
> accessing shared data structures, whatever they are.
<snip>

This is one of those places where the GIL is a good thing, and makes
your life simpler. You could consider it that the interpreter does the
locking for you for such primitive operations, if you like.
--
John Krukoff <jkrukoff@ltgc.com>
Land Title Guarantee Company

== 3 of 3 ==
Date: Tues, Mar 2 2010 5:00 pm
From: MRAB


John Krukoff wrote:
> On Tue, 2010-03-02 at 22:54 +0100, mk wrote:
> <snip>
>> No need to use synchro primitives like locks?
>>
>> I know that it may work, but that strikes me as somehow wrong... I'm
>> used to using things like Lock().acquire() and Lock().release() when
>> accessing shared data structures, whatever they are.
> <snip>
>
> This is one of those places where the GIL is a good thing, and makes
> your life simpler. You could consider it that the interpreter does the
> locking for you for such primitive operations, if you like.

I suppose it depends on the complexity of the data structure. A dict's
methods are threadsafe, for example, but if you have a data structure
where access leads to multiple method calls then collectively they need
a lock.

==============================================================================
TOPIC: Method / Functions - What are the differences?
http://groups.google.com/group/comp.lang.python/t/72ab93ba395822ed?hl=en
==============================================================================

== 1 of 1 ==
Date: Tues, Mar 2 2010 2:00 pm
From: Eike Welk


John Posner wrote:
> I've updated the text at this location:
>
> > http://cl1p.net/bruno_0301.rst/

I think this is a very useful writeup!

It would be perfect with a little bit of introduction that says:
1. - What it is: "The rough details of method look-up";
2. - which contains some of the questions that that made that authors write
the text. This way people with similar questions can find it with Google.

Additionally the link to the relevant section in the Python documentation
would be great. I can't find it!

A link to an article about the details of class creation and metaclasses
would be good too.


Thanks for writing this great little text,
Eike.


==============================================================================
TOPIC: cpan for python?
http://groups.google.com/group/comp.lang.python/t/ecd51ced8d24593e?hl=en
==============================================================================

== 1 of 1 ==
Date: Tues, Mar 2 2010 2:47 pm
From: TomF


On 2010-03-02 13:14:50 -0800, R Fritz <rfritz@u.washington.edu> said:

> On 2010-02-28 06:31:56 -0800, ssteinerX@gmail.com said:
>>
>> On Feb 28, 2010, at 9:28 AM, Someone Something wrote:
>>
>>> Is there something like cpan for python? I like python's syntax, but
>>> Iuse perl because of cpan and the tremendous modules that it has. --
>>
>> Please search the mailing list archives.
>>
>> This subject has been discussed to absolute death.
>
> But somehow the question is not in the FAQ, though the answer is. See:
>
> <http://www.python.org/doc/faq/library/#how-do-i-find-a-module-or-application-to-perform-task-x>

There
>
is also a program called cpan, distributed with Perl. It is used for
searching, downloading, installing and testing modules from the CPAN
repository. It's far more extensive than setuptools. AFAIK the python
community has developed nothing like it.

-Tom


==============================================================================
TOPIC: Broken references in postings
http://groups.google.com/group/comp.lang.python/t/658a7033105e20f3?hl=en
==============================================================================

== 1 of 1 ==
Date: Tues, Mar 2 2010 2:53 pm
From: aahz@pythoncraft.com (Aahz)


In article <hmjiuc$7pk$1@reader1.panix.com>,
Grant Edwards <invalid@invalid.invalid> wrote:
>
>I've noticed recently that a lot of the "refernces" and
>"in-reply-to" headers in c.l.p are broken, resulting in the
>inability to move from a child to a parent in a tree.

One issue with the mail/news gateway is that (unless it's been fixed)
In-Reply-To: does not get copied to References: (which is what most
newsreaders need to thread properly).
--
Aahz (aahz@pythoncraft.com) <*> http://www.pythoncraft.com/

"Many customs in this life persist because they ease friction and promote
productivity as a result of universal agreement, and whether they are
precisely the optimal choices is much less important." --Henry Spencer

==============================================================================
TOPIC: Is this secure?
http://groups.google.com/group/comp.lang.python/t/ffff2b290db4e811?hl=en
==============================================================================

== 1 of 1 ==
Date: Tues, Mar 2 2010 2:59 pm
From: aahz@pythoncraft.com (Aahz)


In article <mailman.120.1267548006.23598.python-list@python.org>,
Robert Kern <robert.kern@gmail.com> wrote:
>On 2010-02-28 01:28 AM, Aahz wrote:
>> In article<mailman.247.1267115557.4577.python-list@python.org>,
>> Robert Kern<robert.kern@gmail.com> wrote:
>>>
>>> If you are storing the password instead of making your user remember
>>> it, most platforms have some kind of keychain secure password
>>> storage. I recommend reading up on the APIs available on your targeted
>>> platforms.
>>
>> Are you sure? I haven't done a lot of research, but my impression was
>> that Windows didn't have anything built in.
>
>You're right, not built-in, but Windows does provide enough crypto
>services for a cross-platform Python implementation to be built:
>
> http://pypi.python.org/pypi/keyring

Thanks you! That's a big help!
--
Aahz (aahz@pythoncraft.com) <*> http://www.pythoncraft.com/

"Many customs in this life persist because they ease friction and promote
productivity as a result of universal agreement, and whether they are
precisely the optimal choices is much less important." --Henry Spencer

==============================================================================
TOPIC: Email Script
http://groups.google.com/group/comp.lang.python/t/76c43e013743795b?hl=en
==============================================================================

== 1 of 1 ==
Date: Tues, Mar 2 2010 3:24 pm
From: Steve Holden


Victor Subervi wrote:
> On Tue, Mar 2, 2010 at 11:48 AM, Victor Subervi <victorsubervi@gmail.com
[...]
> This sends only the first of the two emails. Why doesn't it work to
> send the second? What do?
> TIA,
> beno
>
>
> Should I put a timer between instances of Email?
>
>
Np.

http://en.wikipedia.org/wiki/Cargo_cult_programming

regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
PyCon is coming! Atlanta, Feb 2010 http://us.pycon.org/
Holden Web LLC http://www.holdenweb.com/
UPCOMING EVENTS: http://holdenweb.eventbrite.com/


==============================================================================
TOPIC: Multiprocessing problem
http://groups.google.com/group/comp.lang.python/t/3909e9c08cc8efe1?hl=en
==============================================================================

== 1 of 2 ==
Date: Tues, Mar 2 2010 3:04 pm
From: Matt Chaput


On 3/2/2010 3:59 PM, Matt Chaput wrote:
> I'm trying to use a simple pattern where a supervisor object starts a
> bunch of worker processes, instantiating them with two queues (a job
> queue for tasks to complete and an results queue for the results). The
> supervisor puts all the jobs in the "job" queue, then join()s the
> workers, and then pulls all the completed results off the "results"
queue.

> Here's a simplified example:
>
> http://pastie.org/850512

I should mention that if I change my code so the workers just pull
things off the job queue but don't put any results on the result queue
until after they see the None sentinel in the job queue and break out of
the loop, I don't get the deadlock. So it's something about getting from
one queue and putting to another queue in close proximity.

Hopefully I'm making a simple mistake with how I'm using the library and
it'll be easy to fix...

Thanks,

Matt


== 2 of 2 ==
Date: Tues, Mar 2 2010 4:53 pm
From: MRAB


Matt Chaput wrote:
> Hi,
>
> I'm having a problem with the multiprocessing package.
>
> I'm trying to use a simple pattern where a supervisor object starts a
> bunch of worker processes, instantiating them with two queues (a job
> queue for tasks to complete and an results queue for the results). The
> supervisor puts all the jobs in the "job" queue, then join()s the
> workers, and then pulls all the completed results off the "results" queue.
>
> (I don't think I can just use something like Pool.imap_unordered for
> this because the workers need to be objects with state.)
>
> Here's a simplified example:
>
> http://pastie.org/850512
>
> The problem is that seemingly randomly, but almost always, the worker
> processes will deadlock at some point and stop working before they
> complete. This will leave the whole program stalled forever. This seems
> more likely the more work each worker does (to the point where adding
> the time.sleep(0.01) as seen in the example code above guarantees it).
> The problem seems to occur on both Windows and Mac OS X.
>
> I've tried many random variations of the code (e.g. using JoinableQueue,
> calling cancel_join_thread() on one or both queues even though I have no
> idea what it does, etc.) but keep having the problem.
>
> Am I just using multiprocessing wrong? Is this a bug? Any advice?
>
There's a difference between multithreading and multiprocessing.

In multithreading the threads share the same address space, so objects
can be passed between the threads simply by passing references to those
objects.

In multiprocessing, however, the process don't share an address space,
so the objects themselves need to be transferred between the processes
via pipes, but the pipes have a limited capacity.

If the main process doesn't get the results from the queue until the
worker processes terminate, and the worker processes don't terminate
until they've put their results in the queue, and the pipe consequently
fills up, then deadlock can result.

==============================================================================
TOPIC: Draft PEP on RSON configuration file format
http://groups.google.com/group/comp.lang.python/t/09ce33197b330e90?hl=en
==============================================================================

== 1 of 2 ==
Date: Tues, Mar 2 2010 3:36 pm
From: Steven D'Aprano


On Tue, 02 Mar 2010 11:30:32 -0800, Patrick Maupin wrote:

> On Mar 2, 11:59 am, Terry Reedy <tjre...@udel.edu> wrote:
>
>> To me, comparing object notation with programming language is not
>> helpful to the OP's purpose.
>
> Yes, I agree, it was a distraction. I fell into the trap of responding
> to the ludicrous claim that "if X is a superset of Y, then X cannot
> possibly look better than Y" (a claim made by multiple people all
> thinking it was clever) by showing that Y has other supersets that do in
> fact look better than Y.

It's not ludicrous.

You claim that:

(1) JSON is too hard to edit;

(2) RSON is a superset of JSON (the PEP even explicitly says "All valid
UTF-8 encoded JSON files are also valid RSON files");

(3) which implies that all JSON files are valid RSON files.

If you reject the logical conclusion that RSON must therefore also be too
hard to edit, then perhaps JSON isn't too hard to edit either.

You seem to be taking the position that if you start with a config file
config.json, it is "too hard to edit", but then by renaming it to
config.rson it magically becomes easier to edit. That *is* ludicrous.

Perhaps what you mean to say is that JSON *can be* (not is) too hard to
edit, and RSON *can be* too hard to edit too, but RSON has additional
benefits, including being easier to edit *sometimes*.

So far you have done (in my opinion) a really poor job of explaining what
those benefits are. You've bad-mouthed existing config formats, then
tried to convince us that RSON is almost exactly the same as one of those
formats apart from a couple of trivial changes of spelling (True for
true, etc.).

In my opinion, if you're going to get any traction with RSON, you need to
demonstrate some examples of where JSON actually is hard to write, and
show how RSON makes it easier. It's not good enough showing badly written
JSON, it has to be examples that can't be written less badly given the
constraints of JSON.


--
Steven


== 2 of 2 ==
Date: Tues, Mar 2 2010 4:33 pm
From: Paul Rubin


Steven D'Aprano <steve@REMOVE-THIS-cybersource.com.au> writes:
> (3) which implies that all JSON files are valid RSON files.
>
> If you reject the logical conclusion that RSON must therefore also be too
> hard to edit, then perhaps JSON isn't too hard to edit either.

I would say that JSON is hard to edit because, among other things, it
has no comment syntax. It's quite difficult to maintain a hand-edited
JSON file, or figure out what to edit into it, if it can't have any
comments in it describing what it's doing. JSON is a serialization
format for machine to machine communication, not intended for hand
editing. Simply adding a comment syntax to JSON would go a long way
towards making it easier to edit.

==============================================================================
TOPIC: os.fdopen() issue in Python 3.1?
http://groups.google.com/group/comp.lang.python/t/49a2ca4c1f9e7a59?hl=en
==============================================================================

== 1 of 2 ==
Date: Tues, Mar 2 2010 3:45 pm
From: Albert Hopkins


On Tue, 2010-03-02 at 17:32 +0000, MRAB wrote:
> The documentation also mentions the 'pty' module. Have you tried that
> instead?

I tried to use pty.fork() but it also produces the same error.

I also tried passing 'r', and 'rb' to fdopen() but it didn't make any
difference.

-a


== 2 of 2 ==
Date: Tues, Mar 2 2010 3:59 pm
From: Albert Hopkins


This appears to be Issue 5380[1] which is still open. I've cc'ed myself
to that issue.

[1] http://bugs.python.org/issue5380


==============================================================================
TOPIC: UNA VETRINA SUL MONDO
http://groups.google.com/group/comp.lang.python/t/fffb1509044f49ef?hl=en
==============================================================================

== 1 of 1 ==
Date: Tues, Mar 2 2010 4:08 pm
From: "RBCOM MEDIA GROUP"


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>ITALIA WEEKEND</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>


<body bgcolor="#006699" background="http://www.rbcom.it/mailing_02-10/down.jpg" text="#FFFF00" link="#FFFF00" vlink="#FFFF00" alink="#FFFF00" leftmargin="0" topmargin="0" rightmargin="0" bottommargin="0">
<div align="center">
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="#333366">
<tr>
<td width="100%" height="931" valign="top" background="http://www.rbcom.it/mailing_02-10/wpa.jpg" bgcolor="#006699">
<div align="center"> </div>
<div align="center">
<table width="600" align="center" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF">
<tr>
<td width="100%" height="80" valign="top" bgcolor="#006699"> <div align="center">
<table width="100%" border="0" cellspacing="15" cellpadding="6">
<tr>
<td> <p><font color="#FFFF00" size="4" face="Georgia, Times New Roman, Times, serif"><em>Pregiatissima
Azienda</em></font><font color="#FFFFFF" size="3" face="Geneva, Arial, Helvetica, sans-serif">,
<br>
Sottoponiamo alla Vostra cortese attenzione la rivista
di turismo, cultura, arte e spettacolo &#8220;<strong><font color="#FFFF00">ITALIA
WEEKEND</font></strong>&#8221;. <br>
<br>
Resa ancora pi&ugrave; bella nella sua nuova veste grafica
essa rappresenta un magazine completo da cui trarre
idee, spunti e suggerimenti sugli innumerevoli itinerari
d&#8217;arte, percorsi turistici ed enogastronomici
del nostro Paese.<br>
<br>
Le sue rubriche, redatte anche in lingua inglese, affrontano
temi interessanti volti a soddisfare la curiosit&agrave;
delle lettrici e dei lettori che amano la nostra Penisola.<br>
<br>
&Egrave; <font color="#FFFF00"><strong>distribuita gratuitamente
</strong></font>su tutto il territorio nazionale e,
in particolar modo nei luoghi pi&ugrave; famosi d&#8217;Italia.<br>
<br>
&Egrave; presente, inoltre, nelle molteplici manifestazioni
organizzate nel corso dell&#8217;anno nelle varie regioni
italiane; in tali occasioni la rivista, &egrave; distribuita
a tutto il pubblico presente, dando di conseguenza una
<font color="#FFFF00"> <strong>maggiore visibilit&agrave;
agli inserzionisti.</strong></font></font></p>
<p align="center"><a href="http://www.italiainweekend.it/iwk/indexer.htm" target="_blank"><img src="http://www.rbcom.it/mailing_02-10/mag.png" width="560" height="210" border="0"></a></p>
<p align="left"><font color="#FFFFFF" size="3" face="Geneva, Arial, Helvetica, sans-serif">La
<font color="#FFFF00"> <strong>capillarit&agrave; della
distribuzione</strong></font> sul territorio italiano,
supportata anche da una versione on line che raggiunge
<font color="#FFFF00"> <strong>centinaia di migliaia
di utenti anche all'estero</strong></font>, e la peculiarit&agrave;
della rivista volta a un settore strategico per l&#8217;intero
Paese, continua a suscitare ampi consensi da parte di
numerose aziende e operatori economici del settore turistico.<br>
<br>
Il magazine, oltre ad avere i<font color="#FFFF00"><strong>
normali spazi pubblicitari</strong></font>, d&agrave;
la possibilit&agrave; agli inserzionisti di poter disporre,
grazie alla cellofanatura esterna, d&#8217;<strong><font color="#FFFF00">ulteriori
strumenti promozionali</font></strong> quali: brochure,
dvd e cos&igrave; via.<br>
<br>
<font face="Georgia, Times New Roman, Times, serif"><em>Nella
speranza di potervi annoverare tra i nostri inserzionisti,
e ringraziandovi per l&#8217;attenzione prestataci,
porgiamo i nostri pi&ugrave; cordiali saluti.<br>
</em></font></font></p></td>
</tr>
</table>
</div></td>
</tr>
<tr>
<td height="20" valign="top" background="http://www.rbcom.it/mailing_02-10/down.jpg"><table width="100%" border="0" cellspacing="5" cellpadding="4">
<tr>
<td width="76%" height="30"> <div align="right"><font color="#006699" size="2" face="Geneva, Arial, Helvetica, sans-serif">ulteriori
informazioni su</font><font color="#FFFFFF" size="2" face="Geneva, Arial, Helvetica, sans-serif">
<a href="http://www.italiainweekend.it/iwk">www.italiainweekend.it/iwk</a></font></div></td>
<td width="24%" height="30"><a href="http://www.italiainweekend.it/iwk/media.htm" target="_blank"><img src="http://www.rbcom.it/mailing_02-10/rb.png" width="40" height="30" border="0"></a></td>
</tr>
</table></td>
</tr>
<tr>
<td valign="top" bgcolor="#006699">&nbsp;</td>
</tr>
</table>
</div></td>
</tr>
</table>

<br>
<font color="#333333" size="1" face="Geneva, Arial, Helvetica, sans-serif">Ai
sensi del D.Lgs 196/2003 informiamo che il Suo indirizzo e-mail &egrave; stato
reperito attraverso <br>
fonti di pubblico dominio o attraverso e-mail o adesioni da noi ricevute.<br>
Tutti i destinatari della mail sono in copia nascosta (D.Lgs 196/2003). Qualora
il messaggio pervenga<br>
anche a persona non interessata, preghiamo volercelo cortesemente segnalare
rispondendo<br>
CANCELLAMI all'indirizzo <a href="mailto:cancellami@italiainweekend.it">cancellami@italiainweekend.it</a>
precisando l'indirizzo<br>
che si desidera sia immediatamente rimosso dalla mailing list. Tendiamo ad<br>
evitare fastidiosi MULTIPLI INVII, ma laddove ci&ograve; avvenisse preghiamo
di<br>
segnalarcelo e ce ne scusiamo sin d'ora. Grazie. </font><font color="#333333" size="2" face="Geneva, Arial, Helvetica, sans-serif"></font> </div>
</body>
</html>


==============================================================================
TOPIC: Image.frombuffer and warning
http://groups.google.com/group/comp.lang.python/t/ee441d531cec25fe?hl=en
==============================================================================

== 1 of 1 ==
Date: Tues, Mar 2 2010 4:30 pm
From: News123


Hi,

I am using the PIL function from_buffer in python 2.6.4

I am having the line
im2 = Image.frombuffer('L',(wx,wy),buf)


I receive the warning:
> ./pytest.py:63: RuntimeWarning: the frombuffer defaults may change in
a future release; for portability, change the call to read:
> frombuffer(mode, size, data, 'raw', mode, 0, 1)
> im2 = Image.frombuffer('L',(wx,wy),buf)


Naively I assumed, that changing my code to


im2 = Image.frombuffer('L',(wx,wy),buf,'raw','L',0,1)


should fix the issue:

However I receive exactly the same error as before.

What am I doing wrong?


thanks a lot in advance and bye


N

==============================================================================
TOPIC: python 2.6: how to modify a PIL image from C without copying forth and
back
http://groups.google.com/group/comp.lang.python/t/c456d88ea2773a7e?hl=en
==============================================================================

== 1 of 1 ==
Date: Tues, Mar 2 2010 4:38 pm
From: News123


Hi,

I created a grayscale image with PIL.

Now I would like to write a C function, which reads a;most all pixels
and will modify a few of them.


My current approach is:
- transform the image to a string()
- create a byte array huge enough to contain the resulting image
- call my c_function, which copies over the entire image in order
to modify a few pixels
How can I achieve this with the least amount of copies?


########## Python code snippet ################

im = Image.open('grayscalefile_onebyteperpixel')
wx,wy = im.size

# create a string in order to pass it to my function
# I'm afraid this involves copying so want to get rid of it
im_as_string = im.tostring()

# create a byte array in order to store my result
new_img_array = array.array('B', [0]*(wx*wy) )


# my function which should just change some pixels has
# to copy all unmodified pixels
my_extension.my_func(wx,wy,im_as_string,new_img_array)


im = Image.frombuffer('L',(wx,wy),new_img_array)
show(im2)

############ C wrapper code snippet ###############

int wx,wy;
Py_buffer img;
Py_buffer new_img;
Py_buffer table;
unsigned char *img_ptr;
unsigned char *new_img_ptr;

int ok = PyArg_ParseTuple(args,
"iis*w*",&wx,&wy,&img,&new_img);
img_ptr = (unsigned char *) img.buf;
new_img_ptr = (unsigned char *) new_img.buf;
my_func(wx,wy,img_ptr,new_img_ptr);


Thanks in advance for any suggestions to make this more efficient.


bye


N

==============================================================================

You received this message because you are subscribed to the Google Groups "comp.lang.python"
group.

To post to this group, visit http://groups.google.com/group/comp.lang.python?hl=en

To unsubscribe from this group, send email to comp.lang.python+unsubscribe@googlegroups.com

To change the way you get mail from this group, visit:
http://groups.google.com/group/comp.lang.python/subscribe?hl=en

To report abuse, send email explaining the problem to abuse@googlegroups.com

==============================================================================
Google Groups: http://groups.google.com/?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate