Re: Newbie Question - Overloading ==



On Mar 31, 3:42 pm, Amit Gupta <emaila...@xxxxxxxxx> wrote:
On Mar 31, 11:00 am, xkenneth <xkenn...@xxxxxxxxx> wrote:

Yeah, this is what I'm talking about:

def __eq__(self, other) :
  try :
     return <>
  except AttributeError:
     return False

That seems a bit nasty to me.

One thing about python (IMO); you can't just say this doesn't look
good. You need to say: why do you think this is not good.
To me, it appears a concise and local solution to your problem.

Yes it is, but it's also tedious and lengthy for should-be simple
statements.
.



Relevant Pages

  • Re: default value in __init__
    ... It has nothing to do with lambda, lambda just happens to be a ...     print cb ... that newbies ask about these semantics doesn't imply that they'd ask ... But that's easy to do with current Python: ...
    (comp.lang.python)
  • Re: Self function
    ... Python ... giving the programmer the ability to have a function refer to ... def parrot: ...     print inspect.getmembers ...
    (comp.lang.python)
  • Re: Im a python addict !
    ...     # using Python ... IMO there are two obvious problems with the latter approach. ... Consider that in some jurisdictions the amber light shows ... case available in Python as well, at the cheaper price of fewer ...
    (comp.lang.python)
  • Re: ANN: GMPY 1.10 alpha with support for Python 3
    ... which fixes that bug and adds Unicode support for Python 2.x ... 3.x without gmpy so I have been putting it off): ... At some point I watched the memory usage profile from Windows. ...   for i in range: ...
    (comp.lang.python)
  • Re: Strange crash issue on Windows w/ PyGTK, Cairo...
    ... the actual problem is (ie, Python, PyGTK, or gtk+), but I figure I'll ... I've been building an app which is meant to be run on both Linux and ...  When running on Windows, though, the app exhibits the ...   1) When the .py of the main file which runs the application GUI first ...
    (comp.lang.python)