[Python-Dev] posixpath module.
Fredrik Lundh
Fredrik Lundh" <effbot@telia.com
Sat, 15 Jul 2000 21:22:42 +0200
alex wrote:
>
> Should posixpath.expandvars throw a SyntaxError if it encounters
> unbalanced curly braces?
>=20
> >>> import posixpath
> >>> posixpath.expandvars('/dir1/dir${DIR_NUM/dir2')
> '/dir1/dir${DIR_NUM/dir2'
> >>>=20
probably not; code using it might not be prepared
to handle an exception...
what does the Unix shell do in this case?
(intuitively, I'd treat ${FOO as $FOO, say:
_varprog =3D re.compile(r'\$(\{[^{}$]*\}|{?\w+|)')
but that's me...)
</F>