On 18/07/11 14:25, Christoph Zwerschke wrote:
> Am 18.07.2011 13:20 schrieb M.-A. Lemburg:
>> True. Some modules are also using %i and %f to bind
>> integers and floats.
>>
>>> So when writing a driver,
>>> do I need to support '%f' or not?
>>
>> The question is not whether you need to support them. You can
>> choose among the available formats. You don't need to support
>> all of them. One will do just fine.
> 
> Sorry, I was unclear. I meant *if* my driver advertizes itself with
> paramstyle='format', does it need to support '%f' or does it suffice to
> support '%s'? Same for 'pyformat'? From your answer above, it would need
> to support '%f' as well. And does it also need to support flags, width,
> precision, length modifiers such as '%.2f'?
> 
> My concrete problem was that I wanted to support Infinity and NaN where
> Postgres has a different spelling from Python and needs quotes. This is
> more difficult to implement if '%f' is allowed.

IMO, nothing except %s is allowed. Letting the user choose a format it
is very much like letting the user do the escaping: Bad Thing (TM).

federico

-- 
Federico Di Gregorio                                       f...@initd.org
  Qu'est ce que la folie? Juste un sentiment de liberté si
   fort qu'on en oublie ce qui nous rattache au monde... -- J. de Loctra

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
DB-SIG maillist  -  DB-SIG@python.org
http://mail.python.org/mailman/listinfo/db-sig

Reply via email to