Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

2.4 VS 3.1 for simple print

13 views
Skip to first unread message

earthlink

unread,
Jul 10, 2009, 5:16:13 PM7/10/09
to
Why does

print "GarbageCollector: collected %d objects." % (gc.collect())

work in 2.4 but not in 3.1?

Chris Rebert

unread,
Jul 10, 2009, 5:28:07 PM7/10/09
to pytho...@python.org

Define "works". What error are you getting? Include the exact message
and full error traceback.
Or if no exception is being raised, explain exactly how is it behaving
differently from your expectations.

Cheers,
Chris
--
http://blog.rebertia.com

"Martin v. Löwis"

unread,
Jul 10, 2009, 5:30:53 PM7/10/09
to
> Why does
> print "GarbageCollector: collected %d objects." % (gc.collect())
>
> work in 2.4 but not in 3.1?

Because print is a function in 3.1, so you have to follow it with
a parenthesis.

Regards,
Martin

Ben Finney

unread,
Jul 10, 2009, 7:37:53 PM7/10/09
to
"earthlink" <noen> writes:

For this and other differences introduced in the Python 3.x series, see
<URL:http://www.python.org/dev/peps/pep-3100/>.

--
\ “Please do not feed the animals. If you have any suitable food, |
`\ give it to the guard on duty.” —zoo, Budapest |
_o__) |
Ben Finney

Lawrence D'Oliveiro

unread,
Jul 11, 2009, 8:21:12 PM7/11/09
to
In message <87hbxkm...@benfinney.id.au>, Ben Finney wrote:

> For this and other differences introduced in the Python 3.x series, see
> <URL:http://www.python.org/dev/peps/pep-3100/>.

People never thank you for an "RTFM" response.

Ben Finney

unread,
Jul 12, 2009, 5:34:56 AM7/12/09
to

It's a good thing I avoid giving such responses, then. (Pointing someone
to the specific document isn't “RTFM”.)

--
\ “Leave nothing to chance. Overlook nothing. Combine |
`\ contradictory observations. Allow yourself enough time.” |
_o__) —Hippocrates |
Ben Finney

0 new messages