#python - Sat 21 Apr 2007 between 14:24 and 14:38

NY Lost Funds



SpCombyou should be able to raise any class, even if it doesn't inherit from Exception
what does your raise line look like?
plastic_wrapraise ClassB('error %s' % (code), e)
and the line above it is.... except IOError, e:
SpCombdoesn't make sense to me
MoHaXwhat does it mean? "instance has no attribute '__getitem__'"
plastic_wrapSpComb: ok, thanks anyway
SpCombplastic_wrap: python version?
stepzMoHaX: you're trying to index an object that is unindexable
MoHaXstepz: it raises on my own class access. how to make it indexable and what does it mean?
plastic_wrap2.4.4c1
MoHaXstepz: I get it on this line of code: "spinfo[:] = [spresult for spresult in spinfo if not spresult[0] == player]" Player instance has no attribute __getitem__.
stepzeither spinfo or spresult can't be accessed as an array
for example are you sure that spresult[0] is correct?
qebabyou define __getitem__ and __setitem__ for them maybe?
plastic_wrapSpComb: if i change ClassB to inherit straight from Exception, it works fine.
SpCombplastic_wrap: class A (Exception) -> class B (A) -> raise B() works fine here, having A inherit object breaks it
must be some weird new-style classes mojo
MoHaXqebab: I've not defined that attrs by hand
qebabokay
did you inherit from something?
haysfreakin' x-chat
Brendplastic_wrap, do your classes inherit from anything else?
plastic_wrapSpComb: but do you call the base constructor from ClassB, eg super(ClassB, self)__init__(something) ???
MoHaXoh I see now. It comes in rare condition when spinfo is emply list, and it wasn't handled correctly
hayssuper is considered harmful
MoHaXqebab: but why It tells me about Player instance, not spinfo/spresult?
plastic_wrapBrend: Nup. ClassB -> ClassA --> Exception
SpCombhays: so we should just stop using inheritance instead?
BrendWhat Python version?
hayshttp://fuhm.net/super-harmful/
SpComb19:25:44 < plastic_wrap> 2.4.4c1
plastic_wrapBrend: 2.4.4c1
SpCombplastic_wrap: nope, all classes are empty (pass)
qebabMoHaX: I haven't seen the code, and don't know. But it seems that you try to access something in player with [index] and __getattr__ isn't defined
isn't it enough to call the superclass' __init__ method?
plastic_wrapSpComb: let me try that here...
qebabfrom inside the subclass __init__ method
SpCombI have 2.4.4 as well
BrendHm. Inheriting B straight from Exception breaks too for me

Page: 1 8 15 22 29 36 43 50 57 64 

IrcArchive

NY Lost Funds