[issue10880] do_mkvalue and 'boolean'

2011-02-27 Thread Dj Gilcrease

Dj Gilcrease digitalx...@gmail.com added the comment:

Correct the tests. They passed before but had a logic flaw that caused them to 
never test that the correct boolean value was being returned.

--
Added file: http://bugs.python.org/file20938/issue10880_68064.patch

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



[issue10880] do_mkvalue and 'boolean'

2011-02-27 Thread Dj Gilcrease

Changes by Dj Gilcrease digitalx...@gmail.com:


Removed file: http://bugs.python.org/file20929/issue10880_rev68064.patch

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



[issue968063] Add fileinput.islastline()

2011-02-26 Thread Dj Gilcrease

Dj Gilcrease digitalx...@gmail.com added the comment:

Updated the patch and tests for py3.3

--
keywords: +patch
nosy: +Digitalxero
Added file: http://bugs.python.org/file20928/cpython_rev68060.patch

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



[issue10880] do_mkvalue and 'boolean'

2011-02-26 Thread Dj Gilcrease

Dj Gilcrease digitalx...@gmail.com added the comment:

Add a boolean format option to Py_BuildValue and Py_VaBuildValue

Also added some tests to test_capi that verifies Py_BuildValue is building the 
right type. I did not add tests for every possible type as it has lived this 
long without, but I did want to test my new code.

--
keywords: +patch
nosy: +Digitalxero
Added file: http://bugs.python.org/file20929/issue10880_rev68064.patch

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



Re: finding element by tag in xml

2010-02-20 Thread Dj Gilcrease
On Sat, Feb 20, 2010 at 9:27 AM, sWrath swrath swr...@gmail.com wrote:
 from xml.dom.minidom import parse
 from xml.etree.ElementTree import*

 file1=book.xml
 tmptree=ElementTree()
 tmptree.parse(file1)
 items=root.getiterator()


 dom = parse(file1)


 #Find tag names
 for node in items :
    if node.tag == 'author': #Get tag
        print dom.getElementsByTagName ('book') #Error 1

You are mixing two different types of xml parsers, either user minidom

for node in dom.getElementsByTagName('author'):
print node.getElementsByTagName('book')

or use etree

for el in items:
if el.tag == 'author':
print el.find('book')

There are a few differences you need to note, the getElementsByTagName
always returns a list even if there is only 1 element and find only
returns the first element found no matter what. If you want to print
all books associated with an author you would need to do something
like

for author in tmptree.getiterator('author'):
for book in author.getiterator('book'):
print book
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: list vs tuple for a dict key- why aren't both hashable?

2009-11-08 Thread Dj Gilcrease
On Sun, Nov 8, 2009 at 11:15 AM, Wells we...@submute.net wrote:
 I'm not quite understanding why a tuple is hashable but a list is not.
 Any pointers? Thanks!

tuple is hashable because it is immutable whereas a list is mutable.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Are min() and max() thread-safe?

2009-09-16 Thread Dj Gilcrease
I dont see anything wrong with it and it works for me on a sequence of 5000
-- 
http://mail.python.org/mailman/listinfo/python-list


Application Packages

2009-09-15 Thread Dj Gilcrease
Say I have an application that lives in /usr/local/myapp it comes with
some default plugins that live in /usr/local/myapp/plugins and I allow
users to have plugins that would live in ~/myapp/plugins

Is there a way to map ~/myapp to a user package so I could do from
user.plugins import * or better yet map it to myapp.user?


Dj Gilcrease
OpenRPG Developer
~~http://www.openrpg.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Application Packages

2009-09-15 Thread Dj Gilcrease
when looking up namespace-packages I found pkgutil which lets me add a
myapp.user package with the following in its __init__.py and nothing
else

import os, os.path

from pkgutil import extend_path
homedir = os.environ.get('HOME') or os.environ.get('USERPROFILE')
__path__ = extend_path([os.path.abspath(homedir + os.sep + 'myapp')], __name__)



now I can do from myapp.user.plugins import * and it works
-- 
http://mail.python.org/mailman/listinfo/python-list


[issue6655] etree iterative find[text]

2009-08-05 Thread Dj Gilcrease

New submission from Dj Gilcrease digitalx...@gmail.com:

I recently converted a project from using a custom  implementation of 
xml.dom.minidom to using EelemntTree that comes with python2.5+ and 
found myself wishing for a find(tag_or_path) method that would do so 
iteratively instead of just on the current elements direct children. 
This is possible with the code as written;

looking_for = None
for el in etree.getiterator(tag_or_path):
looking_for = el
break

I have to do this type of action so often in my code that I just decided 
to grab the python implementation of etree that came with py2.6 and 
include it with my app and patch in an iter_find method as the instant 
break for loop is just asking for maintenance issues down the road what 
I forget why I was breaking on the first loop no matter what.

--
components: XML
files: ElementTree.py.patch
keywords: patch
messages: 91348
nosy: Digitalxero
severity: normal
status: open
title: etree iterative find[text]
type: feature request
versions: Python 2.7, Python 3.2
Added file: http://bugs.python.org/file14663/ElementTree.py.patch

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



[issue6655] etree iterative find[text]

2009-08-05 Thread Dj Gilcrease

Dj Gilcrease digitalx...@gmail.com added the comment:

second patch file

--
Added file: http://bugs.python.org/file14664/ElementPath.py.patch

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