Re: "Naked" typecast functions?

Federico Di Gregorio <fog-NGVKUo/i/[email protected]> Thu, 22 Apr 2010 08:51:36 +0200
Newsgroups gmane.comp.python.db.psycopg.devel
Message-ID <[email protected]>
On 21/04/2010 22:58, Karsten Hilbert wrote:
>> psycopg2.NUMBER("12.34", None)
>> > 
>> > note that the second argument ought to be a cursor but you can safely
>> > pass None to almost all the typecasters except for the UNICODE one
>> > because it needs some information about the encoding of the string and
>> > will try to get it from cursor.connection.
> Should UNICODE() then get a third, optional, keyword argument using
> which you can, if you want to, pass in an encoding ? In case you don't
> and it being the default None psycopg2 will still try getting it from
> cursor.connection:

I don't think so. While you _can_ use typecast objects there is no
reason to encourage using them outside of the correct environment, i.e.,
with a cursor/connection available.

-- 
Federico Di Gregorio                                       fog-NGVKUo/i/[email protected]
                   Ma chi sei?....-il trafficante di Nutella? -- Giorgia

_______________________________________________
Psycopg mailing list
Psycopg-IAPFreCvJWPBWskQ1e/[email protected]
http://lists.initd.org/mailman/listinfo/psycopg
signature.asc (application/pgp-signature, 262 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkvP8f8ACgkQvcCgrgZGjest2gCcDnDz2O69nERPzu56p0s+LBHm
5U4AnizDHz/BSox0PEKPABCH6jtIBeVY
=T8Ce
-----END PGP SIGNATURE-----