Re: value of pi and 22/7

2011-03-18 Thread Kee Nethery

On Mar 18, 2011, at 5:17 AM, Neil Cerutti wrote:

 On 2011-03-18, peter peter.mos...@talk21.com wrote:
 The Old Testament (1 Kings 7,23) says ... And he made a molten
 sea, ten cubits from the one brim to the other: it was round
 all about, and his height was five cubits: and a line of thirty
 cubits did compass it round about. .  So pi=3.  End Of.
 
 RIIght.  What's a cubit?

I use cubits all the time. The distance from my elbow to my finger tips equals 
one cubit. When you don't have a proper measuring tape, it can be pretty 
accurate for comparing two measurements.

Kee Nethery


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


Re: value of pi and 22/7

2011-03-17 Thread Kee Nethery
My favorite approximation is: 355/113  (visualize 113355 split into two 113 355 
and then do the division). The first 6 decimal places are the same.

3.141592920353982 = 355/113
vs
3.1415926535897931 

Kee Nethery



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


Re: Books recommendation

2010-12-07 Thread Kee Nethery

On Dec 7, 2010, at 5:39 AM, Octavian Rasnita wrote:

 Do you have, or can I find elsewhere a recommendation for books,tutorials and 
 sites appropriate for beginners?

I have found that Python for Dummies is the book I use the most. It has lots of 
examples that work and that I can build upon. The O'Reilly books talk about the 
language but are scarce on actual code.

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


Re: Python documentation too difficult for beginners

2010-11-02 Thread Kee Nethery

On Nov 2, 2010, at 11:07 AM, Ian wrote:

 On 02/11/2010 14:47, jk wrote:
 I think the key difference is that I don't want to have to *read*
  the
 python docs - I want to be able to scan for what I'm looking for and
 find it easily. That makes me productive.
 
 Hi jk, 
 
 I totally agree. But you will get nowhere. 
 
 A few weeks back I complained that 
 http://docs.python.org/reference/executionmodel.html#naming-and-binding
 was more than a little opaque - and was not understood by Python noobs such 
 as myself. 
 
 I was invited to rewrite it and submit an improved version.  

In this world of moderated wikis one would think that noobs such as myself 
could enhance the docs when we find something confusing in the docs. insert 
snarky comment here

Kee

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


Re: Python documentation too difficult for beginners

2010-11-02 Thread Kee Nethery

 
 
 Therefore, if you truly want changes in the documentation, I suggest that,
 rather then whining to the group, you make some of the changes yourself.
 
 I agree up to here, with a different interpretation of the last clause.
 Work within the existing system. There are currently 250 open doc issues on 
 the tracker at bugs.python.org.

wow, a backlog of 250. Either 250 is the weekly submittal amount and they get 
dealt with within a week, OR the backlog is months old and the bug system is 
not an effective way to get changes or enhancements to the documentation. 
Either way, 250 open doc issues gives me the feeling that the existing 
documentation system is not working for the people trying to use it.

 After registering, go to the search page
 http://bugs.python.org/iss...@template=searchstatus=1
 select Components: Documentation and hit Return (or [Search])
 
 Find an issue that is waiting for someone to suggest a new or replacement 
 sentence or paragraph, and make one. No .diff patch required, just put it in 
 the message. Or look at existing suggestions and comment.

Given that newbies are the ones who run into these issues and have a great 
desire to spare others the pain they have suffered trying to learn Python, and 
newbies typically do not know about the bug tracking system as the way to 
request enhancements to the docs (that's not how wikipedia and other sites do 
changes to information), perhaps it would be useful to put a link to a page 
that explains how to improve the docs, on each doc page? 

I have to agree with others. My preferred Python documentation is either the 
books I have, or a search on Google. A google search typically has several 
postings from people on non-official sites with the exact same confusion I 
have, and what they have tried and what ultimately worked. The suggestion was 
made that people create their own documentation if they don't like the official 
documentation, and that does seem to be a good source for python documentation.

Kee Nethery


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


Re: Introducing Kids to Programming: Scratch

2010-09-27 Thread Kee Nethery
My son has been writing games using MIT's Scratch. It is visual and highly 
interactive. In an afternoon he can build something that looks cool to him, is 
interactive, and that he can share with others. It's not Python but he is 
learning how to make the tools do what he wants and he is getting results. He's 
8 years old.

http://scratch.mit.edu

For introducing kids to programming, I recommend Scratch.

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


Re: Is This Open To SQL Injection?

2010-07-07 Thread Kee Nethery
Yes, you SQL would be trivial to manipulate via SQL injection.

Not only do you need to validate each piece of data submitted by a user, you 
need to escape all the wildcard characters that your database uses. If the text 
string supplied by a user has quotes or parens or wildcard characters, the text 
could be interpreted as SQL and that is what you must avoid.

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


Re: switch

2009-12-08 Thread Kee Nethery
I string together a bunch of elif statements to simulate a switch

if foo == True:
blah
elif bar == True:
blah blah
elif bar == False:
blarg
elif 

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


Re: elementtree XML() unicode

2009-11-03 Thread Kee Nethery


On Nov 3, 2009, at 5:27 PM, John Machin wrote:


On Nov 4, 11:01 am, Kee Nethery k...@kagi.com wrote:

Having an issue with elementtree XML() in python 2.6.4.

This code works fine:

  from xml.etree import ElementTree as et
  getResponse = u'''?xml version=1.0 encoding=UTF-8?
customershippingstatebobble/statecityhead/
citystreetcity/street/shipping/customer'''
  theResponseXml = et.XML(getResponse)

This code errors out when it tries to do the et.XML()

  from xml.etree import ElementTree as et
  getResponse = u'''?xml version=1.0 encoding=UTF-8?
customershippingstate\ue58d83\ue89189\ue79c8C/statecity
\ue69f8f\ue5b882/citystreet\ue9ab98\ue58d97\ue58fb03/street/
shipping/customer'''
  theResponseXml = et.XML(getResponse)

In my real code, I'm pulling the getResponse data from a web page  
that

returns as XML and when I display it in the browser you can see the
Japanese characters in the data. I've removed all the stuff in my  
code
and tried to distill it down to just what is failing. Hopefully I  
have

not removed something essential.

Why is this not working and what do I need to do to use Elementtree
with unicode?


On Nov 4, 11:01 am, Kee Nethery k...@kagi.com wrote:

Having an issue with elementtree XML() in python 2.6.4.

This code works fine:

 from xml.etree import ElementTree as et
 getResponse = u'''?xml version=1.0 encoding=UTF-8?
customershippingstatebobble/statecityhead/
citystreetcity/street/shipping/customer'''
 theResponseXml = et.XML(getResponse)

This code errors out when it tries to do the et.XML()

 from xml.etree import ElementTree as et
 getResponse = u'''?xml version=1.0 encoding=UTF-8?
customershippingstate\ue58d83\ue89189\ue79c8C/statecity
\ue69f8f\ue5b882/citystreet\ue9ab98\ue58d97\ue58fb03/street/
shipping/customer'''
 theResponseXml = et.XML(getResponse)

In my real code, I'm pulling the getResponse data from a web page  
that

returns as XML and when I display it in the browser you can see the
Japanese characters in the data. I've removed all the stuff in my  
code
and tried to distill it down to just what is failing. Hopefully I  
have

not removed something essential.

Why is this not working and what do I need to do to use Elementtree
with unicode?


What you need to do is NOT feed it unicode. You feed it a str object
and it gets decoded according to the encoding declaration found in the
first line.


That it uses the encoding declaration found in the first line is the  
nugget of data that is not in the documentation that has stymied me  
for days. Thank you!


The other thing that has been confusing is that I've been using dump  
to view what is in the elementtree instance and the non-ASCII  
characters have been displayed as numbered  
entities (city#26575;#24066;/city) and I know that is not the  
representation I want the data to be in. A co-worker suggested that  
instead of dump that I use et.tostring(theResponseXml,  
encoding='utf-8') and then print that to see the characters. That  
process causes the non-ASCII characters to display as the glyphs I  
know them to be.


If there was a place in the official docs for me to append these  
nuggets of information to the sections for  
xml.etree.ElementTree.XML(text) and  
xml.etree.ElementTree.dump(elem) I would absolutely do so.


Thank you!
Kee Nethery



So take the str object that you get from the web (should
be UTF8-encoded already unless the header is lying), and throw that at
ET ... like this:

| Python 2.6.4 (r264:75708, Oct 26 2009, 08:23:19) [MSC v.1500 32 bit
(Intel)] on win32
| Type help, copyright, credits or license for more
information.
|  from xml.etree import ElementTree as et
|  ucode = u'''?xml version=1.0 encoding=UTF-8?
| ... customershipping
| ... state\ue58d83\ue89189\ue79c8C/state
| ... city\ue69f8f\ue5b882/city
| ... street\ue9ab98\ue58d97\ue58fb03/street
| ... /shipping/customer'''
|  xml= et.XML(ucode)
| Traceback (most recent call last):
|   File stdin, line 1, in module
|   File C:\python26\lib\xml\etree\ElementTree.py, line 963, in XML
| parser.feed(text)
|   File C:\python26\lib\xml\etree\ElementTree.py, line 1245, in
feed
| self._parser.Parse(data, 0)
| UnicodeEncodeError: 'ascii' codec can't encode character u'\ue58d'
in position 69: ordinal not in range(128)
| # as expected
|  strg = ucode.encode('utf8')
| # encoding as utf8 is for DEMO purposes.
| # i.e. use the original web str object, don't convert it to unicode
| # and back to utf8.
|  xml2 = et.XML(strg)
|  xml2.tag
| 'customer'
|  for c in xml2.getchildren():
| ...print c.tag, repr(c.text)
| ...
| shipping '\n'
|  for c in xml2[0].getchildren():
| ...print c.tag, repr(c.text)
| ...
| state u'\ue58d83\ue89189\ue79c8C'
| city u'\ue69f8f\ue5b882'
| street u'\ue9ab98\ue58d97\ue58fb03'
| 

By the way: (1) it usually helps to be more explicit than errors
out, preferably the exact copied/pasted output as shown above; this
is one of the rare cases where the error message

elementtree XML() unicode

2009-11-03 Thread Kee Nethery

Having an issue with elementtree XML() in python 2.6.4.

This code works fine:

 from xml.etree import ElementTree as et
 getResponse = u'''?xml version=1.0 encoding=UTF-8?  
customershippingstatebobble/statecityhead/ 
citystreetcity/street/shipping/customer'''

 theResponseXml = et.XML(getResponse)

This code errors out when it tries to do the et.XML()

 from xml.etree import ElementTree as et
 getResponse = u'''?xml version=1.0 encoding=UTF-8?  
customershippingstate\ue58d83\ue89189\ue79c8C/statecity 
\ue69f8f\ue5b882/citystreet\ue9ab98\ue58d97\ue58fb03/street/ 
shipping/customer'''

 theResponseXml = et.XML(getResponse)

In my real code, I'm pulling the getResponse data from a web page that  
returns as XML and when I display it in the browser you can see the  
Japanese characters in the data. I've removed all the stuff in my code  
and tried to distill it down to just what is failing. Hopefully I have  
not removed something essential.


Why is this not working and what do I need to do to use Elementtree  
with unicode?


Thanks, Kee Nethery
--
http://mail.python.org/mailman/listinfo/python-list


Re: elementtree XML() unicode

2009-11-03 Thread Kee Nethery


On Nov 3, 2009, at 4:44 PM, Gabriel Genellina wrote:

En Tue, 03 Nov 2009 21:01:46 -0300, Kee Nethery k...@kagi.com  
escribió:


I've removed all the stuff in my code and tried to distill it down  
to just what is failing. Hopefully I have not removed something  
essential.


Sounds like I did remove something essential.



et expects bytes as input, not unicode. You're decoding too early  
(decoding early is good, but not in this case, because et does the  
work for you). Either feed et.XML with the bytes before decoding, or  
reencode the received xml text in UTF-8 (since this is the declared  
encoding).


Here is the code that hits the URL:
getResponse1 = urllib2.urlopen(theUrl)
getResponse2 = getResponse1.read()
getResponse3 = unicode(getResponse2,'UTF-8')
theResponseXml = et.XML(getResponse3)

So are you saying I want to do:
getResponse1 = urllib2.urlopen(theUrl)
getResponse4 = getResponse1.read()
theResponseXml = et.XML(getResponse4)

The reason I am confused is that getResponse2 is classified as an  
str in the Komodo IDE. I want to make sure I don't lose the non- 
ASCII characters coming from the URL. If I do the second set of code,  
does elementtree auto convert the str into unicode? How do I deal with  
the XML as unicode when I put it into elementtree as a string?


Very confusing. Thanks for the help.

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


Re: elementtree XML() unicode

2009-11-03 Thread Kee Nethery


On Nov 3, 2009, at 7:06 PM, Gabriel Genellina wrote:

En Tue, 03 Nov 2009 23:06:58 -0300, Kee Nethery k...@kagi.com  
escribió:


If there was a place in the official docs for me to append these  
nuggets of information to the sections for  
xml.etree.ElementTree.XML(text) and  
xml.etree.ElementTree.dump(elem) I would absolutely do so.


http://bugs.python.org/ applies to documentation too.


I've submitted documentation bugs in the past and no action was taken  
on them, the bugs were closed. I'm guessing that information that  
everyone knows not being in the documentation is not a bug. It's my  
fault I'm a newbie and I accept that. Thanks to you two for helping me  
get past this block.


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


Re: Pyfora, a place for python

2009-11-02 Thread Kee Nethery
I just noticed the tag line a place for Python. Looked it up online (http://pyfora.org/ 
) and it will be interesting to see if it can fill the void that I  
experience (no centralized place to post and view user submitted  
sample code) in the existing Python community.


As for user community fragmentation, I would guess that someone would  
be less likely to create such a site if the user community needs were  
being met by the official sites. There is a place for the existing old  
school interaction forums (the IRC channel, the Usenet groups and  
mailing lists), but there is also a place for archived user submitted  
comments.


My personal preference would be a link in each sub-paragraph in the  
official documentation to a wiki page devoted to that specific aspect  
of the Python language. A place were users could augment the  
documentation by providing sample code and by expanding out the  
documentation for those of us who don't live and breath Python in our  
sleep. Real Python coders would not click on the user wiki links and  
all of us newbies could communicate with each other. But until a place  
like that exists, perhaps Pyfora will get us part way there.


Kee


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


elementtree examples

2009-10-19 Thread Kee Nethery

The official elementtree docs:
http://docs.python.org/library/xml.etree.elementtree.html

do not appear to contain examples for each object, interface or  
function. Where would I find examples that use each elementtree  
function, interface and object?


I assume there is some kind of regression testing that is performed on  
the Python code base and that the regression testing probably has many  
many examples.


Is there a link in the official documentation to those regression test  
examples? If not, how do I get a link added to the official docs so  
that I can view all the examples used to test code changes to the  
various modules?


Kee Nethery

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


Re: elementtree examples

2009-10-19 Thread Kee Nethery


On Oct 19, 2009, at 12:06 PM, Paul Rubin wrote:


Kee Nethery k...@kagi.com writes:

do not appear to contain examples for each object, interface or
function. Where would I find examples that use each elementtree
function, interface and object?


effbot.org has a few.


yes I agree it has a few. It's not anywhere close to complete. I am  
looking for examples for each object, interface or function.


If you just take the very first function in the official docs as an  
example:

xml.etree.ElementTree.Comment([text])

The effbot.org site appears to contain no working examples of that  
function. At a minimum it would be kind of nice for two simple  
examples, one with str and one with unicode text showing the XML  
before and after this function acts upon it.


Am looking for that level of documentation for each function,  
interface and object listed in the official docs for elementtree.


Does it exist?

Thanks, Kee Nethery

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


Re: elementtree examples

2009-10-19 Thread Kee Nethery


On Oct 19, 2009, at 1:02 PM, Robert Kern wrote:


On 2009-10-19 14:50 PM, Kee Nethery wrote:

Am looking for that level of documentation for each function,  
interface

and object listed in the official docs for elementtree.

Does it exist?


No.


Thank you.
Kee

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


Re: how to write a unicode string to a file ?

2009-10-16 Thread Kee Nethery


On Oct 16, 2009, at 5:49 PM, Stephen Hansen wrote:

On Fri, Oct 16, 2009 at 5:07 PM, Stef Mientki  
stef.mien...@gmail.com wrote:


snip

The thing is, I'd be VERY surprised (neigh, shocked!) if Excel can't  
open a file that is in UTF8-- it just might need to be TOLD that its  
utf8 when you go and open the file, as UTF8 looks just like ASCII --  
until it contains characters that can't be expressed in ASCII. But I  
don't know what type of file it is you're saving.


We found that UTF-16 was required for Excel. It would not do the  
right thing when presented with UTF-8.


Kee Nethery


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


Re: Project euler no. 3

2009-09-12 Thread Kee Nethery

in checkPrime what do you return when x is less than 2?

On Sep 12, 2009, at 8:46 AM, Someone Something wrote:


But, I'm returning true or false right?

On Sat, Sep 12, 2009 at 11:32 AM, MRAB pyt...@mrabarnett.plus.com  
wrote:

Someone Something wrote:
Project euler (in case you don't know: projecteuler.net http://projecteuler.net 
)



I'm trying to do the third one and here's my current code:

 1 def checkPrime (x):
 2 factors=2;
 3 while factors=x:
 4 if x==factors:
 5 return True;
 6 elif x%factors==0:
 7 return False;
 8 elif x%factors!=0:
 9 factors=factors+1;

You're not returning 'factors', so the function will return None.


 10
 11 factorl=[];
 12 factors=600851475142;
 13
 14 while factors != 1:
 15 if 600851475143%factors==0:
 16 if checkPrime(factors)==True:
 17 print factors;
 18 else:
 19 factors=factors-1;
 20
 21 else:
 22 factors=factors-1;
 23

And it just gets frozen when I run it. I put a

print Loop completed

in one of the loops and it showed up just fine. So, there are two  
possibilities:

1. Its looping in the trillions and taking a while
2. I have a forever loop somewhere


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

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





-
I check email roughly 2 to 3 times per business day.
Kagi main office: +1 (510) 550-1336


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


Re: Which version of python I should use if I just start programming in python?

2009-09-12 Thread Kee Nethery
I am in 2.x because the IDE I am using does not support stepping  
through my code when in 3.x. As soon as the IDE I use supports  
debugging in 3.x, I'm moving up to 3.x.


I would prefer to be in 3.x because all the inconsistencies of how you  
do things in 2.x make it harder than it needs to be to learn the  
language.


People who have been coding in 2.x for along time don't notice how the  
syntax is wonky in places. Their fingers type the right stuff. As a  
newbie I assume that everything works the same way and I am frequently  
surprised. One of the goals of 3.x was to make the language more  
consistent and that would make it easier for us newbies.


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


[issue6660] Desire python.org documentation link to user contribution wiki (per function)

2009-08-24 Thread kee nethery

kee nethery k...@kagi.com added the comment:

No problem. I can parse text in an automated manner very easily. So if  
you need someone to take the doc files and add in wiki URLs for each  
section, I can do that. Happy to volunteer. Worst case is you look at  
what I do and reject it. Best case ... I actually do what you need.
Thanks, Kee

On Aug 24, 2009, at 10:26 AM, Georg Brandl wrote:


 Georg Brandl ge...@python.org added the comment:

 At the moment, I still have to review and merge the SoC branch, so  
 don't
 expect visible changes to happen within a few weeks.

 --

 ___
 Python tracker rep...@bugs.python.org
 http://bugs.python.org/issue6660
 ___

-
I check email roughly 2 to 3 times per business day.
Kagi main office: +1 (510) 550-1336

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6660
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Questions on XML

2009-08-22 Thread Kee Nethery


On Aug 21, 2009, at 7:15 PM, joy99 wrote:


Dear Group,

I like to convert some simple strings of natural language to XML. May
I use Python to do this? If any one can help me, on this.

I am using primarily UTF-8 based strings, like Hindi or Bengali. Can I
use Python to help me in this regard?


As a newbie, the thing that caused me trouble was importing a string  
into the XML parser. The parser seemed to want to open a file and I  
had a string. The solution was one of these:


from xml.etree import ElementTree as et
theXmlDataTree = et.parse(StringIO.StringIO(theXmlString))


from xml.etree import ElementTree as et
theXmlDataTree = et.ElementTree(et.XML(theXmlString))

Not sure which you would use nor what the differences are. I have the  
first set commented out in my code so for some reason I switched to  
the second set of code to take a string and pull it into the XML parser.


Once the string is in the parser, all the examples worked. It was  
getting it into the parser that had me stumped because none of the  
examples showed this situation, it appears to be obvious to someone  
who has used Python for a while.


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


string literal vs string variable

2009-08-22 Thread Kee Nethery


On Aug 22, 2009, at 3:32 AM, Stefan Behnel wrote:



You can use both, but I suspect parsing from StringIO to be slower  
than

parsing from the string directly. That's the case for lxml, at least.

Note that fromstring() behaves the same as XML(), but it reads  
better when

parsing from a string variable. XML() reads better when parsing from a
literal string.


I'm not sure I know the difference between a string variable and a  
literal string. Is the difference as simple as:


somestring = u'stuffhello world/stuff'
fromstring(somestring)  -- string variable
vs
XML(u'stuffhello world/stuff')  -- literal string

Kee


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


Re: Komodo(!)

2009-08-15 Thread Kee Nethery


On Aug 14, 2009, at 1:55 PM, William wrote:


Personally, I rather like Wing


I tried Wing and basically as a newbie, there were too many setup  
parameters that I did not know how to set correctly and I could never  
get it to work for me. It runs under X11 and I guess that was just a  
bit too techie for me to get it to work properly. It's probably a very  
nice IDE and they were certainly helpful with their support but after  
a bunch of back and forths I decided to go back to Komodo.


Have not looked at NetBeans.

I'm a newbie and I need something that just works. Launch it and use  
it. Komodo meets that need for me.


I've heard there is a nice add-on to Eclipse but Eclipse has even more  
setup variables than Wings and I've avoided it for that reason.


Kee

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


Re: Komodo(!)

2009-08-14 Thread Kee Nethery
From the web site it looks like the free version does not include the  
debugging stuff.


I've been using the paid version with the debugger functionality and I  
find it easy to use and incredibly nice for trying to understand what  
the code is doing. The built-in debugger has saved me tons of time,  
especially when troubleshooting CGIs.


I'm using a Mac and of the Python IDEs I looked at, Komodo had the  
easiest to use user interface, in my opinion.


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


[issue6660] Desire python.org documentation link to user contribution wiki (per function)

2009-08-11 Thread kee nethery

kee nethery k...@kagi.com added the comment:

Is there anything I can do to help this happen? Am thinking that these  
are the steps to the process.

1. Create wiki.docs.python.org using the wiki setup template already  
used by wiki.python.org.
2. Lock page creation except for one specific account.
3. Create a template wiki page that has all the subsections desired  
(one per language version)
4. Grab all the existing docs for say version 2.5 moving forward, and  
at each perma-link, add a user contributions wiki link.
5. Keep track of all the user contribution wiki links
6. spin through the list of links and generate all the empty user  
contribution wiki pages.
7. release the docs with the new user contributions wiki links.

I'm not a wiki expert but I'd be happy to build the thing that creates  
each user contribution wiki link in the docs. Then I could pass the  
modified document files back to you. You could verify they are as  
desired. Once that looks good I could have code that spins through the  
links and creates the pages in the wiki.

Kee Nethery

 From: Georg Brandl rep...@bugs.python.org
 Date: August 6, 2009 3:38:33 PM PDT
 To: k...@kagi.com
 Subject: [issue6660] Desire python.org documentation link to user  
 contribution wiki (per function)
 Reply-To: Python tracker rep...@bugs.python.org


 Georg Brandl ge...@python.org added the comment:

 There will be comments for each function/class etc., as well as a
 feature to suggest a change for the proper text of a section.

 --

 ___
 Python tracker rep...@bugs.python.org
 http://bugs.python.org/issue6660
 ___

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6660
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Python docs disappointing - group effort to hire writers?

2009-08-08 Thread Kee Nethery
As someone trying to learn the language I want to say that the tone on  
this list towards people who are trying to learn Python  feels like it  
has become anti-newbies.


Learning a new language is difficult enough without seeing other  
newbies getting shamed for not knowing everything there is to know  
about Python before asking their questions.


For example, the guy who was looking for Python sample code for the  
Google Map API, calling him a troll was harsh. Suggesting he broach  
the question to Google was a reasonable answer. By the same token, his  
asking this list about the missing Python examples seems reasonable  
also. Seems to me that people on a Python list might have some  
background knowledge or even samples of the Google Python code that  
was no longer on the Google web site.


There seems to be a general consensus among the newbies that other  
languages have a user contributions resource tied to the main official  
docs to allow newbies to teach each other what they have learned. The  
desire is for python.org to have the same kind of support resource so  
that us newbies can self support each other.


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


Re: Python docs disappointing - group effort to hire writers?

2009-08-07 Thread Kee Nethery
During all this conversation there was a ticket posted in the bug  
tracking system with the suggestion of each section in the official  
docs linking to a fixed wiki page that can contain user contributions.


The ticket has been closed because this addition to the official docs  
is already in the works.


So ... to everyone who thinks there needs to be a place for user  
comments to augment the official docs, it's supposed to happen. Same  
with corrections to the docs, there is supposed to be a place per  
section where people can post corrections to the docs.


I'm looking forward to the acceleration of improvements to the  
official docs based upon easy to provide user feedback. Glad to see  
that the bug tracking system is going to not be the primary means for  
documentation changes.


Kee

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


Re: Python docs disappointing - group effort to hire writers?

2009-08-07 Thread Kee Nethery


On Aug 7, 2009, at 10:48 AM, alex23 wrote:


Kee Nethery k...@kagi.com wrote:

I'm looking forward to the acceleration of improvements to the
official docs based upon easy to provide user feedback. Glad to see
that the bug tracking system is going to not be the primary means for
documentation changes.


I'm not sure what you see as being fundamentally different between
open access to a bug tracker  open access to a wiki, other than it
being a lot more difficult to have threaded discussion on a wiki.

Why exactly is posting an open comment on a bug tracker somehow
inferior to posting an open comment on a wiki?


It's a good question and deserves a good answer.

* Fewer Steps
* Immediate
* Does not need to be formally reviewed
* Easier to search

For all these comments, assume the starting point is the section in a  
web page that documents a specific python function. Assume the user is  
using the documentation for the first time in attempt to convert to  
Python. Thus, this is the only official Python page they have ever  
seen, they found it via Google and went directly to it. For example  
purposes, I'll use the following page:

http://docs.python.org/reference/lexical_analysis.html
Lets say the user is in section 2.1.3 Comments

Here's the scenario: The user wanted to include # in one of their  
strings and the IDE kept interpreting it as a comment. But they really  
need to use that character in the string. Eventually they find out  
that they can escape the character in their string so that Python  
stops thinking it is the beginning of a comment. They want other users  
to not suffer through the same thing, and they want to contribute to  
the betterment of Python, so they want this information saved so that  
others can avoid the mistake they were making.


* Fewer Steps:

With the bug tracking system, their only option is to lobby to get the  
documentation changed. Lets assume that Python experts all agree that  
the docs should get updated with this gotcha (which as a newbie, they  
are not sure that is a valid assumption and would probably just halt  
in their quest to get the docs updated). But assuming everyone agrees  
this is a valuable addition to the docs so that others can avoid the  
same error, where on this page dues the user submit this bug? There is  
no link on this page to the bug tracking system.


Lets assume they find the bug tracking system through determined  
efforts because they believe there has to be such a thing and they are  
absolutely sure the powers that be want their input. When they find  
the bug tracking system ... they have to create a user account. Then  
they have to wait for the confirming email. Finally they get access to  
the bug tracking system and being a good citizen, they want to make  
sure that they are not duplicating a previously entered bug. What do  
they search on? Do they search for 2.1.3? Do they search for #?  
Chances are, even if they do a whole set of searches, and if there  
really is already another bug entered for the exact same issue, they  
are unlikely to find it.


So they create a bug and now they need to go back and reference the  
link (find the page from their browser history) and type up why they  
think their modification to the documentation is worthy. Then once the  
bug is submitted ... you get the picture, there are a gazillion steps  
just to submit a bug. Most people do not bother to submit little  
helpful hints to the docs because it is too much of a pain to do so  
and there is zero confidence that as a newbie, anyone cares about what  
they found confusing, after all, they are just a newbie and not worthy  
of altering the documentation. (Certainly that opinion has been  
expressed several times on this mailing list).


With a wiki article tied to each section in the docs, they click on  
the link and are taken directly to the wiki page of user contributions  
for this specific  2.1.3 section of the docs. They scan the user  
comments and see that no one else entered a note about this gotcha.  
They click on the edit button, enter their gotcha, save, and they are  
done.


* Immediate:

With the bug tracking system, they struggle to find a place to  
contribute and then once they make their contribution, they have no  
idea whether anyone will ever see it and whether they have just wasted  
a bunch of time.


With the wiki link for that section, in less than a minute, they can  
see the comments they have left attached to that specific section so  
that others can see them too and perhaps avoid the same mistake they  
made. A wiki link encourages new users to be contributors. New users  
are the absolute best source of what is confusing to a new user.


* Does not need to be formally reviewed:

With the bug tracking system, each bug has to be reviewed by a  
volunteer, analyzed, commented on, dealt with.


With a wiki, no one has to look at user comments. They can just leave  
them there and ignore them. Other

[issue6660] Desire python.org documentation link to user contribution wiki (per function)

2009-08-07 Thread kee nethery

kee nethery k...@kagi.com added the comment:

awesome. looking forward to it.
Kee

On Aug 6, 2009, at 3:38 PM, Georg Brandl wrote:


 Georg Brandl ge...@python.org added the comment:

 There will be comments for each function/class etc., as well as a
 feature to suggest a change for the proper text of a section.

 --

 ___
 Python tracker rep...@bugs.python.org
 http://bugs.python.org/issue6660
 ___

-
I check email roughly 2 to 3 times per business day.
Kagi main office: +1 (510) 550-1336

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6660
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Python docs disappointing - group effort to hire writers?

2009-08-06 Thread Kee Nethery


On Aug 6, 2009, at 6:55 AM, Terry Reedy wrote:


RayS wrote:

At 08:35 PM 8/5/2009 -0700, r wrote:

... Any real sense of community is undermined -- or
even destroyed -- to be replaced by virtual equivalents that strive,
unsuccessfully, to synthesize a sense of community.
I've brought up the idea of the quasi-community doc that PHP uses  
to good effect.


And what have you done about setting up such a project?

http://www.php.net/manual/en/language.types.array.php is a prime  
example where 2/3 of the doc is user-contributed comments and code.


I consider consider this to an unreadable mishmash. If you and  
others want something like that, do it.  And quite bitching about  
the work of those of us who have done something compact and  
readable. We are all volunteers here.


As I struggle through trying to figure out how to make python do  
simple stuff for me, I frequently generate samples. If some volunteer  
here would point me towards the documentation that would tell me how I  
can alter the existing Python docs to include sample code, I'd be more  
than happy to do so.


I would like to do it. Please point me to the docs that tell me how  
to do it so that we people with newbie questions and a need for  
examples can get out of your way and do it ourselves.


Thanks,
Kee Nethery



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


[issue6660] Desire python.org documentation link to user contribution wiki (per function)

2009-08-06 Thread kee nethery

New submission from kee nethery k...@kagi.com:

Proposal: For each permalink headline in the official documentation, 
link to a wiki page specific to that headline. Allow users to easily 
view and contribute comments and examples around that specific 
documentation headline. For example:
http://docs.python.org/reference/lexical_analysis.html#string-literal-
concatenation
would have an auto-generated link in the main docs of (for example):
http://wiki.docs.python.org/2.6.2#reference#lexical_analysis.html#string
-literal-concatenation
Easy to create, self administering, perhaps valuable to new users, 
completely unofficial.

Newbies need examples, lots of examples. Newbies have noob questions 
about things they are stumbling across that experienced users have 
forgotten was once confusing. For experienced users that knowledge is 
now part of their Python DNA. According to people on the python-list 
other languages have wiki style user contribution areas that allow 
newbies to document the things they found confusing (and the answers) 
and to provide lots of code examples. Periodically this newbie 
information is rolled back into the official mainline docs. Requiring 
newbies to join this tracking system and to submit bugs is just way to 
complex for something that is now trivial to do with a wiki and it 
obviously causes the new user contributions to be pretty non-existent. 
Python would be a much easier language to learn if newbies could easily 
contribute through the main documentation web site.

--
assignee: georg.brandl
components: Documentation
messages: 91373
nosy: georg.brandl, keenethery, nnorwitz
severity: normal
status: open
title: Desire python.org documentation link to user contribution wiki (per 
function)
type: feature request
versions: Python 2.6, Python 2.7, Python 3.0, Python 3.1, Python 3.2

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6660
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6660] Desire python.org documentation link to user contribution wiki (per function)

2009-08-06 Thread kee nethery

kee nethery k...@kagi.com added the comment:

Georg,
So there will be a link next to each numbered section in the  
documentation that links to a user editable wiki page about that  
section?
That will be highly useful. Glad to hear it. I know I'd like to  
contribute the gotchas I was confused by and the sample code snippets  
that solved a specific generic problem. Having more sample code linked  
from each numbered section in the docs would make my life easier when  
trying to learn Python.
Kee Nethery

On Aug 6, 2009, at 10:56 AM, Georg Brandl wrote:


 Georg Brandl ge...@python.org added the comment:

 This is already in planning; Sphinx will grow a webapp system that  
 also
 allows suggestions for changes.

 --
 resolution:  - later
 status: open - closed

 ___
 Python tracker rep...@bugs.python.org
 http://bugs.python.org/issue6660
 ___

-
I check email roughly 2 to 3 times per business day.
Kagi main office: +1 (510) 550-1336

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6660
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Python docs disappointing - group effort to hire writers?

2009-07-31 Thread Kee Nethery
I too find the Python docs not very useful and it really slows down my  
learning curve.


I wonder if it would make sense to find good tech writers, get a  
quotes, and get some professionally written documentation WITH LOTS OF  
EXAMPLES added to the standard Python documentation tree.


I'd chip in money for that task. I've certainly spent enough buying  
Python books to where it would be very reasonable to chip in the cost  
of one book towards this project. Get enough people ... could be a  
great thing.


Even though it is not the version I use, I would suggest that the  
really detailed docs with lots of examples be written against the  
latest python version.


Just a thought.

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


Re: Python debugger

2009-07-03 Thread Kee Nethery

It's not free but I like the debugger in Komodo IDE.
Lets me simulate a web connection, lets me step through the code and  
examine the variables as it executes, can be run remotely (have not  
played with that aspect yet).
Does variable inspection of the variables so you can dive into the  
parts of arrays and dictionaries to see what the (for example) 5th  
item of the 4th item named blah is set to and what type of data  
element it is (int, unicode, etc). I find it tremendously useful as a  
newbie to Python.

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


Re: question of style

2009-07-02 Thread Kee Nethery
the fact that you felt compelled to explain the one minor point in  
the first snippet tells me that the second snippet does not need that  
explanation and will be easier for someone (like you for example) to  
maintain in the future.

Second snippet would be my choice.
Kee Nethery

On Jul 2, 2009, at 10:23 AM, Simon Forman wrote:


Hey I was hoping to get your opinions on a sort of minor stylistic
point.
These two snippets of code are functionally identical. Which would you
use and why?
The first one is easier [for me anyway] to read and understand, but
slightly less efficient, while the second is [marginally] harder to
follow but more efficient.

## First snippet

if self.higher is self.lower is None: return
if self.lower is None: return self.higher
if self.higher is None: return self.lower

## Second snippet

if self.higher is None:
   if self.lower is None:
   return
   return self.lower
if self.lower is None:
   return self.higher

What do you think?

(One minor point: in the first snippet, the is None in the first
line is superfluous in the context in which it will be used, the only
time self.lower is self.higher will be true is when they are both
None.)
--
http://mail.python.org/mailman/listinfo/python-list





-
I check email roughly 2 to 3 times per business day.
Kagi main office: +1 (510) 550-1336


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


Re: Beginning with Python; the right choice?

2009-06-27 Thread Kee Nethery
I'll give you the same advice I used to give to people when they  
wanted to decide whether to get a Mac or a PC, go with what your local  
group of friends is using.


In general, if you have a local friend who can come over weekly (or  
you can visit weekly) and have them help you with the stumbling  
blocks, that is way more important than whether one language is better  
than another. If there is someone at work who can stop by your desk on  
a daily basis, that is even better.


All computer languages have a learning curve and a whole set of quirks  
that are things that everyone knows (-: unless you are new to the  
language). Eventually you will grok the language and know all the  
weird gotchas that make no sense to a new person and from that point  
forward the documentation will make sense and you'll be able to go  
very far without having to ask others for help. Until that time,  
something as simple as the use of a colon instead of a semi-colon can  
halt your project for weeks. Having someone who can look at your code  
and say there's your problem ... is way more important than the  
language itself.


With all that background, here are my personal choices.

I started a long time ago with FORTRAN, BASIC, assembly language for  
single chip micros, and ultimately Hypercard and AppleScript (on the  
Mac), and finally the language used by the Arduino micros.


I've built a ton of code using Hypercard all the way from web server  
CGIs to standalone user applications, to unattended code that runs  
forever doing a task when needed. Hypercard is no longer a viable  
coding platform so I had to find alternatives.


For GUI stuff on a Mac or PC, I use RunRev.

For all the Hypercard stuff I've built in the past I migrated to  
Runtime Revolution (RunRev) which can be described as a multi-platform  
Hypercard on steroids. The workflow is similar to Cocoa on the Mac.  
You first create the user interface by dragging buttons and fields and  
controllers and such onto windows and then when you like the way the  
user interface works, you write code to have the various interface  
elements do what they are supposed to when a user interacts with them.  
For GUI type applications, things that run on a user's computer,  
sometimes referred to as a heavy client, I find Runtime Revolution to  
be extremely easy and I'm very productive in that environment. I have  
web CGIs built in RunRev and it works quite well but ... it is a  
single threaded system so a web site with tons simultaneous hits will  
have scaling up problems. That said, high traffic web sites do use  
RunRev but I wanted something that was not single threaded for web  
stuff.


For web stuff I have used RunRev but am moving towards Python.

I went with Python mostly because a friend of mine who knows me and  
who writes in many languages, thought it was the best fit for the way  
my mind works, and he volunteered to help me when I get stuck on  
stuff. He helped me find the Komodo IDE and got me set up to where I  
had a very simple hello world CGI that I could expand upon.


Python has a proven ability to scale up and support more users than I  
will ever need to support. It is what Google and many others run on.  
The philosophy is for there to be only one way to perform a function.  
A competent Python programmer can follow the code written by another  
because there is only one dialect of Python (unlike Perl). These are  
things I like about Python.


I'm using Python 2.6.2 with the Komodo IDE and I'm limiting myself to  
the packages that come with the standard install of Python. So I'm not  
using TurboGears or Django or WSGI or any of those, I just use cgi and  
urllib (and urllib2). Until I know enough to really understand what my  
code is doing, and more importantly what those packages are doing or  
not, I'm not going to use add-on packages. So far I have not needed  
them.


All that said, right now I am extremely inefficient in Python as  
compared to RunRev. I can build a fairly complex CGI in RunRev in a  
day, with Python, it takes me a month. Much of that has to do with  
RunRev being a variation of Hypercard (both use a HyperTalk style  
language) and I'm way past the 10,000 hour usage level on the  
HyperTalk language. I'm barely at 100 hours with Python so right now  
everything is a struggle. But I like Python and plan to stick with it.


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


Re: looking for a book on python

2009-06-27 Thread Kee Nethery
I'm a newbie and I need examples and I find that Python for Dummies is  
my best paper source for examples.


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


Re: Python simple web development

2009-06-27 Thread Kee Nethery
Until I'm an experience Python coder, I'm sticking with built-in  
packages only. My simple CGI is:



#!/usr/bin/env python

# this simple CGI responds to a GET or a POST
# send anything you want to this and it will parrot it back.

# a line that starts with #2 is the old-style code you should use that  
works
# with versions less than Python 2.6. I'm using 2.6.2 and am trying to  
use

# code that works with Python 3.x and up.

import cgi ## so that I can be a web server CGI
import os ## only purpose is for getting the CGI client values like IP  
and URL


def main():
# create the output variable and then add stuff to it that gets  
returned

cgiResponseData = 'stuff from the client browser connection:\n'

# so that there is something to return, go through the CGI client  
data

#2 for cgiKey in os.environ.keys():
for cgiKey in list(os.environ.keys()):
# for each client data value, add a line to the output
cgiResponseData = cgiResponseData + \
str(cgiKey) + ' = ' + os.environ[cgiKey] + '\n'

# this says give me a list of all the user inputs posted to the cgi
formPostData = cgi.FieldStorage()

cgiResponseData = cgiResponseData + '\n\nstuff from the URL POST  
or GET:\n'


# cycle through those inputs and output them right back
#2 for keyValue in formPostData:
for keyValue in list(formPostData):
cgiResponseData = cgiResponseData + \
str(keyValue) + ' = ' + formPostData[keyValue].value + '\n'

#2 print 'Content-type: text/html'
#2 print
#2 print cgiResponseData
print('Content-type: text/html')
print('')
print(cgiResponseData)

main()


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


Re: ElementTree.XML(string XML) and ElementTree.fromstring(string XML) not working

2009-06-26 Thread Kee Nethery
First, thanks to everyone who responded. Figured I'd test all the  
suggestions and provide a response to the list. Here goes ...


On Jun 25, 2009, at 7:38 PM, Nobody wrote:

Why do you need an ElementTree rather than an Element? XML(string)  
returns
the root element, as if you had used et.parse(f).getroot(). You can  
turn

this into an ElementTree with e.g. et.ElementTree(XML(string)).


I tried this:
   et.ElementTree(XML(theXmlData))
and it did not work.

I had to modify it to this to get it to work:
   et.ElementTree(et.XML(theXmlData))



formPostData = cgi.FieldStorage()
theXmlData = formPostData['theXml'].value
theXmlDataTree =
et 
.parse 
(makeThisUnicodeStringLookLikeAFileSoParseWillDealWithIt(theXmlData))


If you want to treat a string as a file, use StringIO.


I tried this:
   import StringIO
   theXmlDataTree = et.parse(StringIO.StringIO(theXmlData))
   orderXml = theXmlDataTree.findall('purchase')

and it did work. StringIO converts the string into what looks like a  
file so parse can process it as a file. Cool.


On Jun 25, 2009, at 7:47 PM, unayok wrote:


I'm not sure what you're expecting.  It looks to me like things are
working okay:

My test script:

[snip]


I agree your code works.

When I tried:
   theXmlDataTree = et.fromstring(theXmlData)
   orderXml = theXmlDataTree.findall('purchase')

When I modified mine to programmatically look inside using the for  
element in theXmlDataTree I was able to see the contents. The  
debugger I am using does not offer me a window into the ElementTree  
data and that was part of the problem. So yes, et.fromstring is  
working correctly. It helps to have someone show me the missing step  
needed to confirm the code works and the IDE does not.




On Jun 25, 2009, at 8:04 PM, Carl Banks wrote:

I believe you are misunderstanding something.  et.XML and
et.fromstring return Elements, whereas et.parse returns an
ElementTree.  These are two different things; however, both of them
contain all the XML.  In fact, an ElementTree (which is returned by
et.parse) is just a container for the root Element (returned by
et.fromstring)--and it adds no important functionality to the root
Element as far as I can tell.


Thank you for explaining the difference. I absolutely was  
misunderstanding this.



Given an Element (as returned by et.XML or et.fromstring) you can pass
it to the ElementTree constructor to get an ElementTree instance.  The
following line should give you something you can play with:

theXmlDataTree = et.ElementTree(et.fromstring(theXmlData))


Yes this works.



On Jun 25, 2009, at 11:39 PM, Stefan Behnel wrote:


If you want to parse a document from a file or file-like object, use
parse(). Three use cases, three functions. The fourth use case of  
parsing a

document from a string does not have its own function, because it is
trivial to write

tree = parse(BytesIO(some_byte_string))


:-) Trivial for someone familiar with the language. For a newbie like  
me, that step was non-obvious.


If what you meant is actually parsing from a byte string, this is  
easily

done using BytesIO(), or StringIO() in Py2.x (x6).


Yes, thanks! Looks like BytesIO is a v.3.x enhancement. Looks like the  
StringIO does what I need since all I'm doing is pulling the unicode  
string into et.parse. Am guessing that either would work equally well.




theXmlDataTree =
et 
.parse 
(makeThisUnicodeStringLookLikeAFileSoParseWillDealWithIt(theXmlData))


This will not work because ET cannot parse from unicode strings  
(unless
they only contain plain ASCII characters and you happen to be using  
Python
2.x). lxml can parse from unicode strings, but it requires that the  
XML

must not have an encoding declaration (which would render it non
well-formed). This is convenient for parsing HTML, it's less  
convenient for

XML usually.


Right for my example, if the data is coming in as UTF-8 I believe I  
can do:
   theXmlDataTree = et.parse(StringIO.StringIO(theXmlData), encoding  
='utf-8')



Again, as a newbie, thanks to everyone who took the time to respond.  
Very helpful.

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


ElementTree.XML(string XML) and ElementTree.fromstring(string XML) not working

2009-06-25 Thread Kee Nethery
Summary: I have XML as string and I want to pull it into ElementTree  
so that I can play with it but it is not working for me. XML and  
fromstring when used with a string do not do the same thing as parse  
does with a file. How do I get this to work?


Details:
I have a CGI that receives XML via an HTTP POST as a POST variable  
named 'theXml'. The POST data is a string that the CGI receives, it is  
not a file on a hard disk.


The POSTed string looks like this when viewed in pretty format:

xml
purchase id=1 lang=en
item id=1 productId=369369
nameAutumn/name
quantity1/quantity
price8.46/price
/item
javascriptYES/javascript
/purchase
customer id=123456 time=1227449322
shipping
street19 Any Street/street
cityBerkeley/city
stateCalifornia/state
zip12345/zip
countryPeople's Republic of Berkeley/country
nameJon Roberts/name
/shipping
emailju...@shrimp.edu/email
/customer
/xml


The pseudocode in Python 2.6.2 looks like:

import xml.etree.ElementTree as et

formPostData = cgi.FieldStorage()
theXmlData = formPostData['theXml'].value
theXmlDataTree = et.XML(theXmlData)

and when this runs, theXmlDataTree is set to:

theXmlDataTree  instanceElement xml at 7167b0
attrib  dict{}
tag str xml
tailNoneTypeNone
textNoneTypeNone

I get the same result with fromstring:

formPostData = cgi.FieldStorage()
theXmlData = formPostData['theXml'].value
theXmlDataTree = et.fromstring(theXmlData)

I can put the xml in a file and reference the file by it's URL and use:

et.parse(urllib.urlopen(theUrl))

and that will set theXmlDataTree to:

theXmlDataTree	instance	xml.etree.ElementTree.ElementTree instance at  
0x67cb48


This result I can play with. It contains all the XML.

et.parse seems to pull in the entire XML document and give me  
something to play with whereas et.XML and et.fromstring do not.


Questions:
How do I get this to work?
Where in the docs did it give me an example of how to make this work  
(what did I miss from reading the docs)?


... and for bonus points ...

Why isn't et.parse the only way to do this? Why have XML or fromstring  
at all? Why not enhance parse and deprecate XML and fromstring with  
something like:


formPostData = cgi.FieldStorage()
theXmlData = formPostData['theXml'].value
theXmlDataTree =  
et 
.parse 
(makeThisUnicodeStringLookLikeAFileSoParseWillDealWithIt(theXmlData))


Thanks in advance,
Kee Nethery
--
http://mail.python.org/mailman/listinfo/python-list


Re: ElementTree.XML(string XML) and ElementTree.fromstring(string XML) not working

2009-06-25 Thread Kee Nethery
thank you to everyone, I'll play with these suggestions tomorrow at  
work and report back.


On Jun 25, 2009, at 8:04 PM, Carl Banks wrote:


Because Fredrick Lundh wanted it that way.  Unlike most Python
libraries ElementTree is under the control of one person, which means
it was not designed or vetted by the community, which means it would
tend to have some interface quirks.


Yep


You shouldn't complain: the
library is superb compared to XML solutions like DOM.


Which is why I want to use it.


A few minor
things should be no big deal.


True and I will eventually get past the minor quirks. As a newbie,  
figured I'd point out the difficult portions, things that conceptually  
are confusing. I know that after lots of use I'm not going to notice  
that it is strange that I have to stand on my head and touch my nose 3  
times to open the fridge door. The contortions will seem normal.


Results tomorrow, thanks everyone for the assistance.

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


[issue3005] EasyDialogs - documentation enhancement

2008-05-29 Thread kee nethery

New submission from kee nethery [EMAIL PROTECTED]:

issue: We spent quite a bit of time trying to figure out why EasyDialogs 
was not working, no dialogs were appearing. Eventually I had to check an 
AIM and noticed several icons bouncing in the dock. Scrolled over one 
and it claimed it was Python, and when selected, displayed the dialog we 
had been trying to get to appear. A simple sentence explaining how to 
make the dialog appear would be a useful addition to the documentation. 
URL for the docs shown below. Existing intro paragraph shown below. 
Suggested additional sentence shown below.

url: http://docs.python.org/mac/module-EasyDialogs.html

existing: The EasyDialogs module contains some simple dialogs for the 
Macintosh. All routines take an optional resource ID parameter id with 
which one can override the DLOG resource used for the dialog, provided 
that the dialog items correspond (both type and item number) to those in 
the default DLOG resource. See source code for details.

suggested: The EasyDialogs module contains some simple dialogs for the 
Macintosh. The dialogs get launched in a separate application which 
appears in the dock and must be clicked on for the dialogs be displayed. 
All routines take an optional resource ID parameter id with which one 
can override the DLOG resource used for the dialog, provided that the 
dialog items correspond (both type and item number) to those in the 
default DLOG resource. See source code for details.

Thanks, kee nethery

--
assignee: georg.brandl
components: Documentation
messages: 67507
nosy: georg.brandl, keenethery
severity: normal
status: open
title: EasyDialogs - documentation enhancement
type: feature request
versions: Python 2.5

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3005
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com