Is there a simple way to append a list if X is a string, but extend it if X is a list? I know I can simply test if an object is a string or list, but I was wondering if there is a quicker way than this?
- 3The quickest and simplest way is to write code that doesn't force you later to do this.user395760– user3957602011-01-21 15:58:14 +00:00Commented Jan 21, 2011 at 15:58
- Not possible in this particular circumstance, I'm inheriting X from a backend system and it won't pass single objects as list itemschrism– chrism2011-01-21 16:00:01 +00:00Commented Jan 21, 2011 at 16:00
- 1"it won't pass single objects as list" Sad. And you can't wrap it with a sensible function or extend it with extra methods or subclass it to fix it?S.Lott– S.Lott2011-01-21 16:35:17 +00:00Commented Jan 21, 2011 at 16:35
Add a comment |