• (nodebb)

    Once again demonstrating that a bad enough programmer can write PHP in any language.

  • (nodebb)

    Gotta admire the four levels of dictionary here (key, db, mongoDbTag and 'image'). And the reuse of the names old_yaml_data and new_yaml_data for new_yaml_data and temp respectively.

  • Hmmmm (unregistered)

    New YAML gets overwritten with old YAML, except image fields and some MongoDB metadata. Sounds like some home-brewed kind of container upgrade system.

  • Hmmmm (unregistered) in reply to Hmmmm

    ... except the parameters and/or state to actually make it run keep getting 'juggled forward'

  • TRITS_FOR_THE_WIN (unregistered)

    The best part is that key_exists allows you to check if the type is not a dictionary too (it returns None in the non-dictionary case because ... they forgot to add a default return).

    But the code doesn't use it.

  • (nodebb)

    The main difference is that the custom key_exist will not match a string, where as s in str will do exactly what one expects.

    Sure it returns None if not a dict. The lack of an else is an... odd choice but it should work given how it's used.

    Now, whether the data may have different types is questionable given the script and the usage. One would hope not.

    If it does, that's what we call a "very unfortunate design".

  • y2k16 (unregistered)

    Throwing and catching exceptions is considered the optimum 'Pythonic' way to do control flow by the Python community. Also, key_exists doesn't define a return value when the arg is not a dict, which is more logical than the built-in operator which throws an exception on non collection types but which works on Lists.

Leave a comment on “In the Know”

Log In or post as a guest

Replying to comment #698726:

« Return to Article