Late-binding of function defaults (was Re: What is a function parameter =[] for?)

MRAB python at mrabarnett.plus.com
Thu Nov 26 11:14:21 EST 2015


On 2015-11-26 14:40, BartC wrote:
> On 26/11/2015 13:15, Chris Angelico wrote:
>> On Thu, Nov 26, 2015 at 11:53 PM, BartC <bc at freeuk.com> wrote:
>>> FWIW here is that list of features that are different between Python and my
>>> language, or that work a different way, or that I think could be a useful
>>> addition. (Although Python's internal workings make many impractical.)
>>>
>>> http://pastebin.com/JrVTher6
>>>
>>> This is not an attempt to compare the complete languages as they are for
>>> different purposes (mine is more low-level, simpler, smaller and designed to
>>> make it easier to create an efficient byte-code interpreter for it).
>>
>> "I think Python now has hex, octal and binary literals. X allows any
>> base from 2 to 16: 2x10101 is binary, while 4x101 is quaternary (ie.
>> 20)."
>>
>> Do you mean that 4x101 means 1*(4*4) + 0*(4) + 1? If so, it would be
>> 17, not 20. Is this a typo in the document, or am I misunderstanding
>> your syntax?
>
> Just a mistake. The example had been 4x100 which is 16, but I changed it
> to 4x101 for a bit less confusion, which as you say is 17 not 20 which
> is 4x110.
>
> (Although not used much, I have used quaternary here for example:
>
>     4x3032_3233_2323
>
> The digits represent the number of extra days more than 28 in each
> month, from Jan to Dec.)
>
Smalltalk uses "r" (for "radix") rather than "x", and can handle any 
base from 2 to 36.




More information about the Python-list mailing list