[Python-3000] features i'd like [Python 3000?] ... #4: interpolated strings ala perl

Barry Warsaw barry at python.org
Wed Dec 6 14:04:10 CET 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Dec 6, 2006, at 5:24 AM, Jan Grant wrote:

> PS. IF generic functions (operators) could be sensitive to return  
> types
> and IF python6k supported a complex type inference mechanism (possibly
> including automatic coercion), then one might be able to do something
> like:
>
> def foo(d: sqlDriver):
>   s = "select template goes here" % (param1, param2)
>   r = d.query(s)
>
> where sqlDriver has a method
>
> def query(self, s: some_type_that_signals_sql_interpolation)
>
> and "%" is overloadable on the basis that the return type is  
> determined
> to be compatible with "some_type_that_signals_sql_interpolation".  
> Those
> are some mighty big "IF"s though, and you could still concoct cases
> where things would break :-)

BTW, I believe that most of the SQL wrapper packages for Python  
already provide safe prepared statement like functionality, that is  
convenient to use.

- -Barry

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Darwin)

iQCVAwUBRXa/y3EjvBPtnXfVAQJXTAP/YjVK4fW0cuEd7FauzlDeedO2rXxfkpIg
jsOg573Ce05WcrDYyKR+jJ4KQlfEKZbHgjfkWvRZtXn9U+jvbxcNZooFmKxhqGnK
FLZ4t5vGTcD/n3gjIaEkumh2TdfnWIKcdstPGqrCUQdITvCacuW37zDh7dSiGOcm
4iIipl/UONA=
=snz0
-----END PGP SIGNATURE-----


More information about the Python-3000 mailing list