These are chat archives for ipython/ipython

30th
Nov 2016
Johan Mabille
@JohanMabille
Nov 30 2016 15:15
@minrk Hi, I wonder what default value means for fields in Jupyter messages : does that mean the field can be missing and the kernel will use the default value ? or is it the value that must be set by client when they don't know how to handle it (and in that case the kernel expect them to be present in the message) ?
Min RK
@minrk
Nov 30 2016 15:54
@JohanMabille can you give an example? I think in general it means the former - that the recipient should treat a missing field as the default value.
But it's perhaps best indicated as what the default value for APIs should be, and that actually omitted fields should be rare.
Johan Mabille
@JohanMabille
Nov 30 2016 16:10
@minrk the 'silent' field of 'execute_request' message for instance. The doc says the default is False. So if a kernel receives a execute_request message without this field, should it consider the message as ill-formed ? Or consider the field is present with the value False ?
Min RK
@minrk
Nov 30 2016 16:10
present with False
In Python parlance, a message is a dict, and fields with a default value should be treated as value = content.get('field', default_value)
Johan Mabille
@JohanMabille
Nov 30 2016 16:18
@minrk ok thanks, I was reading the code of kernel_base and was confused by some value treated as value = content['field'] while others are treated as you said.