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


Groups > comp.lang.python > #28116

Re: Beginners question

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 <rosuav@gmail.com>
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 <k1nnj1$cal$1@speranza.aioe.org>
References <k1nk8s$3l4$1@speranza.aioe.org> <mailman.3964.1346328894.4697.python-list@python.org> <k1nnj1$cal$1@speranza.aioe.org>
Date Thu, 30 Aug 2012 23:06:34 +1000
Subject Re: Beginners question
From Chris Angelico <rosuav@gmail.com>
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 <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.3969.1346331996.4697.python-list@python.org> (permalink)
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

Show key headers only | View raw


On Thu, Aug 30, 2012 at 10:50 PM,  <boltar2003@boltar.world> wrote:
> On Thu, 30 Aug 2012 13:14:57 +0100
> MRAB <python@mrabarnett.plus.com> wrote:
>>What don't you ask Python? I'm sure you'' get something like this:
>>
>> >>> type(s)
>><class 'posix.stat_result'>
>
> Umm , no I don't.
>
>>>> type(s)
> <type 'posix.stat_result'>
>
> 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)
> <class '__main__.foo'>

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

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


Thread

Beginners question boltar2003@boltar.world - 2012-08-30 11:54 +0000
  Re: Beginners question MRAB <python@mrabarnett.plus.com> - 2012-08-30 13:14 +0100
    Re: Beginners question Roy Smith <roy@panix.com> - 2012-08-30 08:23 -0400
    Re: Beginners question boltar2003@boltar.world - 2012-08-30 12:50 +0000
      Re: Beginners question Chris Angelico <rosuav@gmail.com> - 2012-08-30 23:06 +1000
        Re: Beginners question boltar2003@boltar.world - 2012-08-30 13:16 +0000
      Re: Beginners question Dave Angel <d@davea.name> - 2012-08-30 09:23 -0400
      Re: Beginners question Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2012-08-30 14:30 +0100
      Re: Beginners question Terry Reedy <tjreedy@udel.edu> - 2012-08-30 14:22 -0400
  Re: Beginners question Dave Angel <d@davea.name> - 2012-08-30 08:25 -0400
    Re: Beginners question boltar2003@boltar.world - 2012-08-30 12:53 +0000
  Re: Beginners question Chris Angelico <rosuav@gmail.com> - 2012-08-30 22:32 +1000
  Re: Beginners question Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2012-08-30 14:49 +0200
    Re: Beginners question Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2012-08-30 16:41 +0200
    Re: Beginners question Hans Mulder <hansmu@xs4all.nl> - 2012-08-30 17:38 +0200
  Re: Beginners question charvigroups@gmail.com - 2012-09-04 23:28 -0700
    Re: Beginners question Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-09-05 09:03 +0100
    Re: Beginners question Dave Angel <d@davea.name> - 2012-09-05 09:21 -0400

csiph-web