Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #104200

Re: Struggeling with collections

From Jussi Piitulainen <jussi.piitulainen@helsinki.fi>
Newsgroups comp.lang.python
Subject Re: Struggeling with collections
Date 2016-03-07 11:31 +0200
Organization A noiseless patient Spider
Message-ID <lf5oaaqfxcc.fsf@ling.helsinki.fi> (permalink)
References <241aeea9-2604-4fa4-bf06-822ba5be143b@googlegroups.com>

Show all headers | View raw


Faling Dutchman writes:

> I am just starting off in python, but have good knowledge of both Java
> and C#. Now is the problem that I need to have multiple instances of

...

> it prints: <__main__.Item object at 0x02EBF3B0>
>
> So that is not usefull to me. There can be an infinite amount of

...

> and it has to show all the parameters of the class Item and not say
> "ive got an object at this memory address, have a nice day"

Others have now told you that your class has a special method that
defines the string representation of instances. What you are seeing is
the default. You can specify your own.

I just want to add that Java does it the same way. Surely this hasn't
changed? (I've never known C#, so no comment on that.)

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Struggeling with collections Faling Dutchman <henriarends92@gmail.com> - 2016-03-07 00:24 -0800
  Re: Struggeling with collections Vincent Vande Vyvre <vincent.vande.vyvre@telenet.be> - 2016-03-07 09:39 +0100
    Re: Struggeling with collections Faling Dutchman <henriarends92@gmail.com> - 2016-03-07 00:58 -0800
  Re: Struggeling with collections Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2016-03-07 19:52 +1100
  Re: Struggeling with collections Gary Herron <gherron@digipen.edu> - 2016-03-07 01:01 -0800
  Re: Struggeling with collections Jussi Piitulainen <jussi.piitulainen@helsinki.fi> - 2016-03-07 11:31 +0200
    Re: Struggeling with collections Faling Dutchman <henriarends92@gmail.com> - 2016-03-07 01:43 -0800
  Re: Struggeling with collections Roel Schroeven <roel@roelschroeven.net> - 2016-03-07 22:55 +0100

csiph-web