Add collection literals note to styleguide

Review Request #4028 — Created June 27, 2016 and submitted

nhoward_tw
pants
pants-reviews
benjyw, jsirois, molsen, zundel

We've brought up using literal sets and tuples in reviews here and there, so I thought I'd take a crack at adding it to the style guide.



  1. 
      
  2. src/docs/styleguide.md (Diff revision 1)
     
     

    I have a minor preference towards set() for sets to avoid confusion with a dictionary. It always seemed weird to me that:

    a = {}
    type(a)

    dict

    a = {1}
    type(a)

    set

    Not a big deal for me though, if this is what everyone else prefers I'm happy to create sets in this way.

  3. 
      
  1. Ship It!
  2. 
      
  1. 
      
  2. src/docs/styleguide.md (Diff revision 1)
     
     

    I agree that this is a weird Python wrinkle, but I still prefer set literals to set().

  3. 
      
  1. Ship It!
  2. 
      
Review request changed

Status: Closed (submitted)

Change Summary:

Submitted as https://github.com/pantsbuild/pants/commit/83446b4ae319e995f7cd074ae7340a2d69eecf09
Loading...