.dbf tables and Null

E

Ethan Furman

Mornin'! and a good one, too, I hope.

Question for you...

First part of the question: What is the general value in having Null
capability for fields?

Second part: Is there a tangible difference between Null, and the
nothing of 0, '', False, etc, in python?

Third part: If there is a tangible difference, do those of us who use
python and these old, refuse-to-die, .dbf files actually have need of,
or have tables including, Null values?

P.S. part (for John Machin, if he sees this ;)
Will the dbf package you are working on support Null values?

Any and all information appreciated!

~Ethan~
 
J

John Machin

Mornin'!  and a good one, too, I hope.

Question for you...

First part of the question:  What is the general value in having Null
capability for fields?

In general, in any database system, so that one can distinguish
between "the customer has no 'middle name'" ('') and "the customer's
'middle name' is unknown" (NULL).
Second part:  Is there a tangible difference between Null, and the
nothing of 0, '', False, etc, in python?

0 is the zero thing, it is not nothing. False is not nothing.

Third part:  If there is a tangible difference, do those of us who use
python and these old, refuse-to-die, .dbf files actually have need of,
or have tables including, Null values?

P.S. part (for John Machin, if he sees this  ;)
Will the dbf package you are working on support Null values?

My philosophy when digging stuff out of arcane storages is to expose
what is found and leave any kludging/sanitising to the next layer.

For example, None is returned for an N (Number) field that's all
spaces; it's up to the caller to decide whether to treat None as zero,
raise an exception, pop up a data-collection dialogue box, ...

If you mean specifically the Visual Foxpro v3 _NullFlags hack, yes, it
already supports that, as well as the VFP9 abuse of that hack for
Varchar and Varbinary fields :)
 
E

Ethan Furman

John said:
In general, in any database system, so that one can distinguish
between "the customer has no 'middle name'" ('') and "the customer's
'middle name' is unknown" (NULL).




0 is the zero thing, it is not nothing. False is not nothing.





My philosophy when digging stuff out of arcane storages is to expose
what is found and leave any kludging/sanitising to the next layer.

For example, None is returned for an N (Number) field that's all
spaces; it's up to the caller to decide whether to treat None as zero,
raise an exception, pop up a data-collection dialogue box, ...

If you mean specifically the Visual Foxpro v3 _NullFlags hack, yes, it
already supports that, as well as the VFP9 abuse of that hack for
Varchar and Varbinary fields :)

Thank you.

It's been an interesting journey learning Python. Probably the two most
difficult concepts for me to really internalize have been "batteries
included" (thank you for the pointer to struct!) (I finally 'found' and
incorporated array into my dbf module), and "everything is an object,
even functions!".

The unittest module worked wonderfully in making sure everything still
worked after switching over to array as well, and the 30+% speed-up is
also nice! :)

All in all, I *love* Python!

~Ethan~
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top