> On 1 Dec 2021, at 12:01 PM, Chris Angelico <ros...@gmail.com> wrote:
> 
> On Wed, Dec 1, 2021 at 6:43 PM Abdulla Al Kathiri
> <alkathiri.abdu...@gmail.com> wrote:
>>> On 1 Dec 2021, at 10:16 AM, Chris Angelico <ros...@gmail.com> wrote:
>>> 3) If "yes" to question 1, would you use it for any/all of (a) mutable
>>> defaults, (b) referencing things that might have changed, (c)
>>> referencing other arguments, (d) something else?
>> I will definitely use it for default mutable collections like list, set, 
>> dictionary etc. I will also use it to reference things that might have 
>> changed. For example, when making callbacks to GUI push buttons, I find 
>> myself at the start of the function/callback to be fetching the values from 
>> other widgets so we can do something with them. Now those values can be 
>> directly passed as late-bound defaults from their respective widgets (e.g., 
>> def callback(self, text1 => self.line_edit.text()): …).
>>> 
> 
> Very interesting. That doesn't normally seem like a function default -
> is the callback ever going to be passed two arguments (self and actual
> text) such that the default would be ignored?
Yeah. Let’s say the callback prints the text on the main window console. I 
could use the same function to print something on the console not related to 
the default widget changing text. Maybe another push button that prints literal 
“WOW”. If I made the second argument a default widget (def callback(self, 
line_edit=self.line_edit):...) and then call line_edit.text() inside the 
function, I would be able to pass any other widget that has the method text() 
but I wouldn’t be able to pass a literal text. 
> 
> But, hey, if it makes sense in your code to make it a parameter, sure!
> 
>>> 5) Do you know how to compile CPython from source, and would you be
>>> willing to try this out? Please? :)
>> I haven’t done it from source. I might try to learn how to do it in the next 
>> weekend and give it a try.
>> 
>>> I'd love to hear, also, from anyone's friends/family who know a bit of
>>> Python but haven't been involved in this discussion. If late-bound
>>> defaults "just make sense" to people, that would be highly
>>> informative.
>> I will show this to some of my coworkers who are python experts and I will 
>> report back.
> 
> Thank you! All feedback greatly appreciated.
> 
> Building CPython from source can be done by following these instructions:
> 
> https://devguide.python.org/setup/
> 
> Instead of creating your own clone from the pristine master copy,
> instead clone my repository at https://github.com/rosuav/cpython and
> checkout the pep-671 branch. That'll give you my existing reference
> implementation (it's pretty crummy but it mostly works).
> 
> ChrisA
> _______________________________________________
> Python-ideas mailing list -- python-ideas@python.org
> To unsubscribe send an email to python-ideas-le...@python.org
> https://mail.python.org/mailman3/lists/python-ideas.python.org/
> Message archived at 
> https://mail.python.org/archives/list/python-ideas@python.org/message/7VOA7BVTV5UJ24HOPMKO4XK6HW73DH5H/
> Code of Conduct: http://python.org/psf/codeofconduct/

_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/HE3ST52STGZQ3OJRVEQ2DGEPCM3RQHZF/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to