[Scons-users] Is this a feature or a bug(

Kenny, Jason L jason.l.kenny at intel.com
Tue Aug 21 18:44:29 EDT 2012


I believe the issue as I see it here is that SCon has API, that would like to have overloading. Ie one case that takes a string and another that takes a collection of strings ( be that a set or list or tuple)

The way SCons is dealing with this is via a type check, which seems to be the python way, as we don’t have any other way to do this.

This could be fixed by always taking a set of strings, But this still requires a check to see if this is a string, otherwise there is no good way to report a useful error to the user.

Jason

From: scons-users-bounces at scons.org [mailto:scons-users-bounces at scons.org] On Behalf Of Kyle J Strand
Sent: Tuesday, August 21, 2012 3:59 PM
To: SCons users mailing list
Cc: scons-users at scons.org; scons-users-bounces at scons.org
Subject: Re: [Scons-users] Is this a feature or a bug(

I agree that from a user perspective, the third argument should be any iterable, but I'd be willing to bet that the tuple is in fact being turned into a single-item list somewhere in the code. This is a hazard of the "if not isinstance(inputarg, list): inputarg = [inputarg]" pattern that seems to show up a lot in the SCons code (and arguably a hazard of ever using "isinstance"). While this is certainly a very Pythonic issue to be running into, I don't think it would be "unPythonic" in the least to fix it. But that might be a question better suited to the dev list.

-----------------------------------------------------------------------
Kyle Strand, Software Intern
Beckman Coulter, Inc., Life Sciences Division
4862 Innovation Drive, Fort Collins, Colorado, 80525
(970) 204-7036

scons-users-bounces at scons.org<mailto:scons-users-bounces at scons.org> wrote on 08/21/2012 01:14:48 PM:


> William Deegan <bill at baddogconsulting.com<mailto:bill at baddogconsulting.com>>

> Sent by: scons-users-bounces at scons.org<mailto:scons-users-bounces at scons.org>

>

> 08/21/2012 01:14 PM

>

> Please respond to

> SCons users mailing list <scons-users at scons.org<mailto:scons-users at scons.org>>

>

> To

>

> scons-users at scons.org<mailto:scons-users at scons.org>

>

> cc

>

> Subject

>

> Re: [Scons-users] Is this a feature or a bug…

>

> On 08/21/2012 08:40 AM, Chris BeHanna wrote:

> > On Aug 21, 2012, at 10:04 , Gary Oberbrunner <garyo at oberbrunner.com<mailto:garyo at oberbrunner.com>> wrote:

> >

> >> On Tue, Aug 21, 2012 at 10:44 AM, Russel Winder

> <russel at winder.org.uk<mailto:russel at winder.org.uk>> wrote:

> >>> Just asking the question prior to putting in a bug report, just in case

> >>> I have missed something…

> >>>

> >>> Command(XXX, YYY, [AAA, BBB])

> >>>

> >>> i.e. the action sequence is a list, works fine. However,

> >>>

> >>> Command(XXX, YYY, (AAA, BBB))

> >>>

> >>> is reported as an error, i.e. a tuple is not acceptable where a list is.

> >>>

> >>> To say this doesn't violate the Principle of Least Surprise would be to

> >>> violate the Principle of Least Surprise.

> >> I can't see any particular reason we shouldn't support tuples as well

> >> as lists there, although actually doing it might be complicated.

> > A tuple, strictly speaking, is not *exactly* the same as a list

> in python. What you might have happen is this:

> >

> > Command(XXX, YYY, (AAA, BBB))

> >

> > gets translated by layers below as

> >

> > Command(XXX, YYY, [(AAA,BBB)])

> >

> > i.e., that tuple becomes a singleton dictionary with a single key-

> value pair, rather than a list with two elements.

> >

> > Thus, I would disagree, looking at it from a strictly

> "pythonic" view, that it violates POLA. I would actually expect it

> not to work properly.

> >

> Likely the third argument should allow any iterable.

> So it could be a generator even.

> The contents of a single element would be what you'd then have to check

> to see if they matched what was expected. (To address your [(aaa,bbb)]

> above.)

>

>

> -Bill

>

> _______________________________________________

> Scons-users mailing list

> Scons-users at scons.org<mailto:Scons-users at scons.org>

> http://four.pairlist.net/mailman/listinfo/scons-users


The server made the following annotations
---------------------------------------------------------------------------------

This message contains information that may be privileged or confidential and is the property of Beckman Coulter, Inc. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message.
---------------------------------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://four.pairlist.net/pipermail/scons-users/attachments/20120821/1d5b64bd/attachment-0001.html>


More information about the Scons-users mailing list