python / cpython

The Python programming language
https://www.python.org
Other
63.86k stars 30.57k forks source link

picklable or pickleable? #125787

Open JelleZijlstra opened 1 month ago

JelleZijlstra commented 1 month ago

Currently the spellings "picklable" (24 times) and "pickleable" (4 times) both appear in our documentation. We should pick one for consistency, and perhaps document it in the devguide.

JelleZijlstra commented 1 month ago

I don't have a preference between the two spellings, and @hugovk tells me the word isn't in the OED. Unless someone comes up with a strong reason (e.g., a style guide), I suggest we pick the more common form in the existing docs ("picklable").

AA-Turner commented 1 month ago

The OED defines 'pickle', 'pickleball', 'pickled', 'pickler', 'picklesome', 'pickle-yard', 'pickling', but indeed no 'pickl(e)able'.

On the '-able' suffix, the OED says:

-able: a. Fr. -able:—L. -ābilem, adj. suffix, the special form taken by the suffix -bili- (see -ble) when added to vbs. in -āre, Fr. -er. Extended in Fr. to vbs. of all conjugations, -ble taking the place of -nt in pr. pple., thus périss-able, recev-able, vend-able, défend-able, mouv-able. Originally found in Eng. only in words from OFr. but soon by analysis of such instances as pass-able, agree-able, amend-able, treated as a living suffix, and freely employed to form analogous adjectives, not only on vbs. from Fr., but at length on native words, as bearable, speakable, breakable, wearable. This extension seems to be largely due to form-association with the adj. able (to which the suffix is not related), so that eatable, e.g. is taken as eat + able, able to be eaten. The vb. has often a n. of the same form, as in debat-able, rat(e)-able; these lead the way to such as carriageable, clubbable, where the n. seems to be the source, and saleable, in which no vb. exists. Recent usage adds -able even to a verbal phrase as get-ˈat-able, come-ˈat-able. Now always with passive sense, but in early words often active, as in comfortable, suitable, able to comfort, suit.

(Copyright © 1989 Oxford University Press.)

Wiktionary adds:

A terminal silent -e is often dropped when adding -able, but for roots ending with a soft -ce or -ge, such as replaceable and changeable, the -e is kept so that these are not misinterpreted as hard ‘c’ or ‘g’ sounds. Similar spelling patterns apply to some other suffixes beginning with a vowel, such as -ous in famous vs. courageous.

As such, I would suggest that the first (picklable) usage is correct.

A

hugovk commented 1 month ago

Also have no strong preference so would go for the more common "picklable". It less likely be "misspelled" in the future.


Wiktionary only has "pickleable" and is defined only for computing: https://en.wiktionary.org/wiki/pickleable (but this can be fixed :)

(This is the only dictionary definition found using the https://onelook.com/?w=pickleable aggregator.)

Interestingly, their related definition of the verb "pickle" is labelled "(programming, in Python)"). https://en.wiktionary.org/wiki/pickle#Verb

And I don't think it's used much in computing outside Python. I didn't find it in any style guides.


Looking at Google Books, there's ~316 results with an E, ~266 without an E, mostly Python books.

Before 1990, there's 32 with E, 7 without. Mostly food pickling. 1869 is the oldest I can find, of the non-eatable or pickleable seed pods of the Madras radish:

image

Anyway, we're not trying to pickle food.


Spelunking our repo, the first three of any spelling are picklable, when Guido added pickle.py in January 1995, the docs for pickle.py in February 1995, and a changelog in March 1995:

The following types can be pickled:

  • None
  • integers, long integers, floating point numbers
  • strings
  • tuples, lists and dictionaries containing picklable objects
  • class instances whose __dict__ or __setstate__() is picklable

Attempts to pickle unpicklable objects will raise an exception after having written an unspecified number of bytes to the file argument.

The first unpickleable was in UnpickleableError added in 1999 but removed by 2008.

nedbat commented 1 month ago

Looking for an English analog, seems like people prefer "tickleable" to "ticklable": https://www.google.com/search?q=tickleable vs https://www.google.com/search?q=ticklable

To me, "pickleable" seems better.

nedbat commented 1 month ago

Or, we could edit the sentences to avoid weird words:

The usual restrictions for pickling apply: picklable enums must be defined in the top level of a module, since unpickling requires them to be importable from that module.

becomes:

The usual restrictions for pickling apply: enums can only be pickled if they are defined in the top level of a module, since unpickling requires them to be importable from that module.

This is clearer anyway.

rishi93 commented 1 month ago

Hi! If nobody has started working on a PR yet, I would like to help with this issue :)

AA-Turner commented 1 month ago

@rishi93 this is currently being discussed, there's nothing to make a PR about yet.

skirpichev commented 1 month ago

perhaps document it in the devguide

Does devguide documents something like this now?

If so, I can propose more cases. E.g. "floating-point" (seems to be preferred in codebase) vs "floating point", "non-integer" vs "noninteger" (see https://math.stackexchange.com/questions/3342643/nonnegative-vs-non-negative/3344027#3344027)...

picnixz commented 1 month ago

There is also the case of samplable vs sampleable but IIRC only the first is correct. So I would be in favor of picklable.

Also, didn't we have a similar discussion with weak-referencable / weak-referenceable? (I think we accpeted both in the end though).

hugovk commented 1 month ago

Does devguide documents something like this now?

Yes, see the style guide:

https://devguide.python.org/documentation/style-guide/

nedbat commented 1 month ago

I switched my vote: compilable, inconsolable, inhalable, reconcilable, recyclable, resalable, salable, and scalable are correct, though saleable and scaleable are also correct. But picklable it is. I still think rewording to avoid the word could often be better.

serhiy-storchaka commented 1 month ago
closeable
decodeable
encodeable
parseable
pickleable
resizeable
shareable
upgradeable
useable
writeable

All these words (also with different prefixes) are used both with -eable and -able endings in the documentation, C and Python files.

nedbat commented 1 month ago

Unfortunately, English is a bit lax here. Of those words, we only get one definitive answer according to https://www.merriam-webster.com/:

nedbat commented 1 month ago

I don't know if this will help us, but I asked claude.ai:

Is there a rule in English when adding -able as a suffix to a word that ends in "e", whether to keep the e or drop it? For example, "write" becomes "writable", but "size" can be either "sizeable" or "sizable". Is there a rule?


Yes, there is a general rule, though it has some exceptions. For words ending in silent 'e', we typically drop the 'e' before adding '-able', unless keeping it serves a purpose:

Basic rule: Drop the silent 'e'

write → writable move → movable love → lovable

Main exception: Keep the 'e' if dropping it would change pronunciation, particularly to protect a soft 'c' or 'g' sound

notice → noticeable (keeps the soft 'c' sound) manage → manageable (keeps the soft 'g' sound) change → changeable

Some words allow both spellings, with the 'e' being optional:

size → sizeable/sizable live → liveable/livable share → shareable/sharable

British English tends to retain the 'e' more often than American English in these optional cases. The trend in modern American English is toward dropping the 'e' when possible.

zware commented 1 month ago

I think the moral of this story is that it's always going to be inconsistent and we can worry about other things :). We can "fix" things one way or the other as they come up in other changes, but I think a sweeping change is just going to go out of date quickly and cause headaches for translators.

nedbat commented 1 month ago

I agree. This doesn't interfere with people's understanding, and there's no clear answer. I'm going to try not to let this become a hobgoblin of my little mind... :)

willingc commented 1 month ago

On other projects we have put both forms in spelling and moved on :wink: