[pylucene-dev] Invalid Names in JCC lucene

Pete pfein at pobox.com
Wed Nov 14 08:06:16 PST 2007


Busy day for me...

It looks like JCC is including generating some type names that aren't valid 
python, such as Field$Index and Field$Store. These appear to be inner 
classes, where $ is used as a separtor.  While this doesn't seem to be 
causing any problems, you can't actually refer to the name in a source 
file/type it at a shell prompt (the $ generates a SyntaxError), which just 
feels kinda weird.

A few possible solutions:

1. Don't make these classes publicly accessible under these names.  You can 
still get to them as attributes, but that still leaves us with odd 
identifiers:
In [2]: lucene.Field.Store.__name__
Out[2]: 'Field$Store'

2. Use a different separtor.  _ or __ or even ___ perhaps?  This seems like a 
better solution to me.

You can get a list of offenders with:
python -c "import lucene; print '\n'.join(n for n in dir(lucene) if '$' in n)"

-- 
Peter Fein   ||   773-575-0694   ||   pfein at pobox.com
http://www.pobox.com/~pfein/   ||   PGP: 0xCCF6AE6B
irc: pfein at freenode.net   ||   jabber: peter.fein at gmail.com


More information about the pylucene-dev mailing list