On Mon, Apr 20, 2020 at 1:47 PM Alex Hall <alex.moj...@gmail.com> wrote:

> On Mon, Apr 20, 2020 at 7:37 PM Christopher Barker <python...@gmail.com>
> wrote:
>
>> On Sun, Apr 19, 2020 at 3:37 AM Alex Hall <alex.moj...@gmail.com> wrote:
>>
>>> ```
>>> File "setup.py", line 2232
>>>         self.add(Extension('_decimal',
>>>                            include_dirs=include_dirs,
>>>                            libraries=libraries,
>>>                            define_macros=define_macros,
>>>                            undef_macros=undef_macros,
>>>                            extra_compile_args=extra_compile_args,
>>>                            sources=sources,
>>>                            depends=depends))
>>>
>>
>> I don't know about all the other examples, but in a setup.py that cries
>> out for a more declarative approach: put all that in a dict, and call
>> Extension('_decimal', **build_params).
>>
>
> Do you mean essentially writing something like:
>
>         build_params = dict(
>             include_dirs=include_dirs,
>             libraries=libraries,
>             define_macros=define_macros,
>             undef_macros=undef_macros,
>             extra_compile_args=extra_compile_args,
>             sources=sources,
>             depends=depends
>         )
>         self.add(Extension('_decimal', **build_params)
>

no -- that would be essentially the same, of course. And would also be
addressed by the "dict uses local names" version of this proposal.

Sorry, I was being lazy -- I was more referring to setup.py files in
general, which I think should be more declarative, not specifically this
one, that I haven't gone to find to see how it's really being used in this
case.

But in the general case, all those local names needed to be set to
something at some point -- it *may* have been just as easy (or easier) to
populate a dict, rather than set them to local names.

And in that example, those looked al lot to me like a bunch of parameters
that would likely be shared among multiple Extensions -- so all the more
reason to have them, as a set, in a dict or something.

I'm sorry I haven't taken the time to go find that example, maybe that one
is as good as it gets, in which case -- <quiet_voice> never mind
</quiet_voice>

-CHB



-- 
Christopher Barker, PhD

Python Language Consulting
  - Teaching
  - Scientific Software Development
  - Desktop GUI and Web Development
  - wxPython, numpy, scipy, Cython
_______________________________________________
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/ZLWMCCFSLG5OICFYESIROPB2PCPOKPAQ/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to