Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.009 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'output': 0.04; 'mrab': 0.05; 'see.': 0.07; 'subject:question': 0.08; 'python': 0.09; 'url:peps': 0.09; 'def': 0.10; 'thread': 0.11; 'aug': 0.13; 'slightly': 0.15; 'easier.': 0.16; 'foo(object):': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'sorts': 0.16; 'wrote:': 0.17; 'basically': 0.17; 'thu,': 0.17; 'url:dev': 0.17; '>>>': 0.18; 'python?': 0.20; 'received:209.85.214.174': 0.21; "python's": 0.23; 'this:': 0.23; 'pass': 0.25; 'header:In-Reply-To:1': 0.25; '+0100': 0.27; 'message-id:@mail.gmail.com': 0.27; '>>>>': 0.29; 'helpful.': 0.29; 'case,': 0.29; 'skip:_ 10': 0.29; 'class': 0.29; "i'm": 0.29; 'url:python': 0.32; 'print': 0.32; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; 'pm,': 0.35; 'received:209.85': 0.35; 'something': 0.35; 'except': 0.36; 'url:org': 0.36; 'being': 0.37; 'why': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'things': 0.38; 'sure': 0.38; 'to:addr:python.org': 0.39; 'received:209.85.214': 0.39; 'header:Received:5': 0.40; 'most': 0.61; 'more.': 0.62; 'developed': 0.62; '30,': 0.62; 'between': 0.63; 'different': 0.63; 'here': 0.65; 'to,': 0.65; 'facilities': 0.69; 'different.': 0.84; 'subtly': 0.84; 'terrible': 0.84; 'thing,': 0.84; 'type(s)': 0.84; 'umm': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=KAIYhjkhxJrh7RXeYHbyb2bIqwKzbblQRoenjzOG9iQ=; b=n6Yng3hVy4UBh850imahuN8vL9UGaGuXD8AjsNqoAAOtgXJvLUuxZHbtDGsiTpEsML AWel+ZIAvBc2LK4gMYBxRFCoU3g7mvqGFl3m6Xz8ZIp5rAOiW5MR+IwO/0Br8j95MV5+ 3Y+k5PG5RVBf2d1CtDNbylcEYIC2ITCsi1zblSaDCg4aQ2VdK95haoLnU7yWQ1osCfX0 ATni4HjRx9aq0ovLtfs3UkrSg99zDqK8wD/A/+Q/TYDWWCHSYvd5iWRYor4gh/8BDe3t BeLWZnBF/T/VJZKKBsnUTBJJx78sC3srVgYegM8J5swgSk6ZiO8kyAUR9WO7QjLz8/nz vTkg== MIME-Version: 1.0 In-Reply-To: References: Date: Thu, 30 Aug 2012 23:06:34 +1000 Subject: Re: Beginners question From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 47 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1346331996 news.xs4all.nl 6898 [2001:888:2000:d::a6]:37804 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:28116 On Thu, Aug 30, 2012 at 10:50 PM, wrote: > On Thu, 30 Aug 2012 13:14:57 +0100 > MRAB wrote: >>What don't you ask Python? I'm sure you'' get something like this: >> >> >>> type(s) >> > > Umm , no I don't. > >>>> type(s) > > > Which isn't terrible helpful. That's actually the same thing, except for a slight difference between Python 2 and Python 3. > If its a class , why is it when I create my own class I get a completely > different output with print and type? > >>>> >>>> class foo(object): > .. def __init__(self): > .. pass > .. >>>> f=foo() >>>> print f > <__main__.foo object at 0xb743956c> >>>> type(f) > Yep, you're using Python 2. A few things are subtly different. Unless you have good reason not to, do consider moving to Python 3; all sorts of things are easier. Python 2 is basically not being developed any more. http://www.python.org/dev/peps/pep-0404/ Alternatively, accept that what people are going to quote to you here may be slightly different from what you see. In any case, Python's introspection facilities and help() features are available on both branches, so most of what has been said in this thread still applies. ChrisA