Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Updated print statements to work with py3; thanks Claude Paroz noting…

… this.
  • Loading branch information...
commit 3bdb65dc5959b62f910ca498cce19682e2db6308 1 parent 4754f12
Tim Graham authored

Showing 1 changed file with 5 additions and 5 deletions. Show diff stats Hide diff stats

  1. 10  docs/ref/models/querysets.txt
10  docs/ref/models/querysets.txt
@@ -1271,7 +1271,7 @@ The :exc:`~django.core.exceptions.DoesNotExist` exception inherits from
1271 1271
         e = Entry.objects.get(id=3)
1272 1272
         b = Blog.objects.get(id=1)
1273 1273
     except ObjectDoesNotExist:
1274  
-        print "Either the entry or blog doesn't exist."
  1274
+        print("Either the entry or blog doesn't exist.")
1275 1275
 
1276 1276
 create
1277 1277
 ~~~~~~
@@ -1538,23 +1538,23 @@ The most efficient method of finding whether a model with a unique field
1538 1538
 
1539 1539
     entry = Entry.objects.get(pk=123)
1540 1540
     if some_query_set.filter(pk=entry.pk).exists():
1541  
-        print "Entry contained in queryset"
  1541
+        print("Entry contained in queryset")
1542 1542
 
1543 1543
 Which will be faster than the following which requires evaluating and iterating
1544 1544
 through the entire queryset::
1545 1545
 
1546 1546
     if entry in some_query_set:
1547  
-       print "Entry contained in QuerySet"
  1547
+       print("Entry contained in QuerySet")
1548 1548
 
1549 1549
 And to find whether a queryset contains any items::
1550 1550
 
1551 1551
     if some_query_set.exists():
1552  
-        print "There is at least one object in some_query_set"
  1552
+        print("There is at least one object in some_query_set")
1553 1553
 
1554 1554
 Which will be faster than::
1555 1555
 
1556 1556
     if some_query_set:
1557  
-        print "There is at least one object in some_query_set"
  1557
+        print("There is at least one object in some_query_set")
1558 1558
 
1559 1559
 ... but not by a large degree (hence needing a large queryset for efficiency
1560 1560
 gains).

0 notes on commit 3bdb65d

Please sign in to comment.
Something went wrong with that request. Please try again.