• Prime Mover (unregistered)

    kwargs, stringness and churn

  • Jaloopa (partially registered) (unregistered)

    true fact, it took me about a year before I realized "kwargs" was short for "keyword arguments

    Got you beat there, Remy. I've been programming for over 10 years and have never thought about it until now

  • Duston (unregistered)

    The Bridge to the River Kwargs?

  • (nodebb)

    True fact: kwargs is a yet to be discovered particle behind dark matter.

  • scriptninja (github) in reply to Mr. TA

    Well maybe if it would get out from behind there someone would discover it.

  • Vault_Dweller (unregistered) in reply to scriptninja

    Have you considered that it might not want to be discovered?

  • ooOOooGa (unregistered)

    Since class names are typically named as nouns, when I see one named 'Lead' I immediately think of the metal with atomic number 82, since the other common word 'lead' is a verb. But I have no idea what this specific metal has to do with filtering arguments. So it is probably something more domain-specific. Like sales leads or maybe horse leads. Those are both also nouns.

    So TRWTF isn't Python, or even PHP. TRWTF is English.

  • (author) in reply to ooOOooGa

    If you read so much that you're well-read, you'll have the background which allows you to lead, instead of being lead.

    I assume this is about sales leads.

  • orangejuice (unregistered)

    If the method "set_filters_to_query" popped "view_by", this would also lead to some funny side effects

  • Smee’); DROP TABLE Users,— (unregistered)

    I accept that that elegance is often sacrificed to bolt misshapen things together, but set_filters_to_query() is the kind of dictionary comprehension taught in even the laziest intro boot camps.

  • OCPythonic (unregistered)
    def set_filters_to_query(modelquery, kwargs2):
        if 'source' in kwargs2 and kwargs2['source'] == u'':
            del kwargs2['source']
    
        filterByKeys = ['affiliate_data','assigned_user','country','lang','source']
        filter_by = {k: kwargs2.pop(k) for k in filterByKeys if k in kwargs2}
            
        return kwargs2, filter_by
    

    Ahhhh I can breathe again...

  • I dunno LOL ¯\(°_o)/¯ (unregistered)

    So kwargs isn't a Klingon commander?

  • (nodebb) in reply to Remy Porter

    lead, instead of being lead

    I see what you did there

  • Fizzlecist (unregistered) in reply to Mr. TA

    I thought he owned the bar on DS9?

  • Fizzlecist (unregistered) in reply to I dunno LOL ¯\(°_o)/¯

    No, he tended bar on DS9

  • OldCoder (unregistered) in reply to I dunno LOL ¯\(°_o)/¯

    If it was a Kilingon commander, then the function would be: set_phasers_to_kill();

  • Worf (unregistered) in reply to ooOOooGa

    And the news industry uses both terms. Lead as in the soft metal used for typesetting, and lead, as the main point of the story. It's not always obvious from context which one they mean. They got around this by having the second sense spelled as lede, so you can often see "burying the lead" as "burying the lede". That way lead referred to the element, and lede to the point of an article.

  • Erwin (unregistered) in reply to ooOOooGa

    Sometimes, 'Lead engineer' is just a fancy job title for a plumber.

  • Markoff Chaney (unregistered) in reply to Worf

    It's actually "lede" when referring to the main point of the story -- check out "burying the lede".

  • Officer Johnny Holzkopf (unregistered) in reply to Prime Mover

    Kwarg them... with the soft cushions!

  • markm (unregistered) in reply to OldCoder

    Klingons don't use phasers. The Federation uses phasers, mostly set to stun. Klingons use disrupters because they don't need any setting but kill.

  • markm (unregistered) in reply to Erwin

    And Led Zeppelin mis-spelled the name of the metal in their name, I guess because they didn't trust their fans to get the joke and pronounce "lead" as "led" rather than "leed".

  • Hasseman (unregistered) in reply to Erwin

    As plumber is a named derived from Plumbum which is lead. Unfortunate this did not lead to the profession to be called leader

  • eric bloedow (unregistered)

    oh, this took me WAY back. back when i had an Apple II, i tried to write a simple game. i tried to use a variable called "score". BUT "or" is a protected word. BUT instead of simply telling me that, the silly computer kept mis-reading it as "sc OR e"! what a pain THAT was to debug.

Leave a comment on “Filter Your Kwargs”

Log In or post as a guest

Replying to comment #:

« Return to Article