Read PGM's with more than 256 range in PIL1.1.7

2010-02-08 Thread Davo
I have a PGM format image file with 4096 range.  When I reads it with
PIL, I get an image with 8-bit values and alternate columns are zero.
Does PIL support reading and writing PGM's with more than 8-bits?

Davo
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: List Comprehension Question: One to Many Mapping?

2007-08-23 Thread Davo
On Aug 23, 9:24 pm, beginner [EMAIL PROTECTED] wrote:
 Hi All,

 How do I map a list to two lists with list comprehension?

 For example, if I have x=[ [1,2], [3,4] ]

 What I want is a new list of list that has four sub-lists:

 [[1,2], [f(1), f(2)], [3,4], [f(3), f(4)]]

 [1,2] is mapped to [1,2] and [f(1), f(2)] and [3,4] is mapped to
 [3,4], [f(3), f(4)].

 I just can't find any way to do that with list comprension. I ended up
 using a loop (untested code based on real code):

 l=[]
 for y in x:
l.append(y)
l.append([f(z) for z in y])

 Thanks,
 Geoffrey

This may be what you want:

l = [[y, [f(z) for z in y]] for y in x]

But It's a bit dense.  How about:
l=[]
for y in x:
Fy = [f(z) for z in y]
l.extend([y, Fy])

-- David

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python Documentation (should be better?)

2005-05-17 Thread Davo
Overall organization is definitely an issue, at least for newer users.
As an occasional python user I remain constantly in a mode of having to
look up basic terminology for examples and exact spelling of terms in
order to knock out a quick script.  I feel very much like Mr. Bottaro
that the docs, while quite good in some ways, can be frustrating and
inconsistent at times.  Here's a link to a concrete and mostly real
stream of consciousness example of using the docs: (rather long)

http://home.pacbell.net/dl_brown/input_something.txt

Many responses from experienced users that show how to find a certain
piece of information really miss the point by a wide margin.  It's nice
that they can find the information easily of course.  It's those who
don't have the experience who can have more trouble.  If the docs,
especially the tutorial, are intended to help those with limited
experience they should try to be a little more fool-proof with regard
to indexing and searching, and also have more basic examples.

Here are a couple specific suggestions for improvements:

-- Please add the basic input methods to the Input/Output section of
the tutorial (see previous link and the original post for this thread)

-- Add a Doc_Feedback button on many of the documentation pages so when
people have problems finding or understanding something they can
immediately and easily send feedback about that specific problem.

-- Consider at least renaming and reordering the main doc page links to
highlight the most important 2 or 3 docs for people who don't know
where to start.  Right now the doc structure is too flat and
disconnected in my opinion.  It needs to act more like a funnel. Today
I have to pick which document might contain the information I need and
if I'm wrong I probably won't find what I'm looking for quickly.  The
present structure seems to work ok for experts, not so well for
novices.

-- If doc maintainers believe the better approach for most people is to
just search (I don't) then move the doc links to the side, put them in
a smaller font, and put a big search box in the middle of the docs
page.  Right now search is in the far corner so the implicit
understanding is that it's not the first thing to try.

-- Find clearer names/descriptions for some documents.  For example
maybe it's just me but what is the _Library_ Reference?  I know about
python modules and python language, etc.  What are python libraries.
Or is it just intended to mean generically a book in a library of
python books?  There was some discussion and debate about which doc was
the Manual  Perhaps one of the docs or a reorganized combination
should be called the Python Online Manual if Manual Implies that it's
the go-to book.

-- And finally, I recall the last time I tried to figure out how to do
something with a date value I looked in the datetime module.  There are
lots of sophisticated tools apparently but I really never grasped how
to go about using them.  A couple basic examples of what can be done
with the tools would be nice.

--  TkInter... (ok I'm done now)

 help(tKinter)
Traceback (most recent call last):
  File stdin, line 1, in ?
NameError: name 'tKinter' is not defined
 help('tkinter')
no Python documentation found for 'tkinter'

 help('tKinter')
no Python documentation found for 'tKinter'

 help('TkIinter')
no Python documentation found for 'TkIinter'

 help('TkInter')
no Python documentation found for 'TkInter'

 help('Tkinter')

Help on module Tkinter:  (don't believe it)


-- David

-- 
http://mail.python.org/mailman/listinfo/python-list