- 21 Agu, 2002 7 kayıt (commit)
-
-
Raymond Hettinger yazdı
-
Raymond Hettinger yazdı
Though slightly slower, has better clarity and teaching value.
-
Raymond Hettinger yazdı
-
Guido van Rossum yazdı
superficial errors and one deep one that aren't currently caught. I'm headed for bed after this checkin. - Fixed several typos introduced by Raymond Hettinger (through cut-n-paste from my template): it's _as_temporarily_immutable, not _as_temporary_immutable, and moreover when the element is added, we should use _as_immutable. - Made the seq argument to ImmutableSet.__init__ optional, so we can write ImmutableSet() to create an immutable empty set. - Rename the seq argument to Set and ImmutableSet to iterable. - Add a Set.__hash__ method that raises a TypeError. We inherit a default __hash__ implementation from object, and we don't want that. We can then catch this in update(), so that e.g. s.update([Set([1])]) will transform the Set([1]) to ImmutableSet([1]). - Added the dance to catch TypeError and try _as_immutable in the constructors too (by calling _update()). This is needed so that Set([Set([1])]) is correctly interpreted as Set([ImmutableSet([1])]). (I was puzzled by a side effect of this and the inherited __hash__ when comparing two sets of sets while testing different powerset implementations: the Set element passed to a Set constructor wasn't transformed to an ImmutableSet, and then the dictionary didn't believe the Set found in one dict it was the same as ImmutableSet in the other, because the hashes were different.) - Refactored Set.update() and both __init__() methods; moved the body of update() into BaseSet as _update(), and call this from __init__() and update(). - Changed the NotImplementedError in BaseSet.__init__ to TypeError, both for consistency with basestring() and because we have to use TypeError when denying Set.__hash__. Together those provide sufficient evidence that an unimplemented method needs to raise TypeError.
-
Guido van Rossum yazdı
possible API improvements.
-
Raymond Hettinger yazdı
-
Raymond Hettinger yazdı
Gains a 5:1 speed-up for membership testing by handling the most common case first (the case where the element is hashable). Closes SF Patch 597444.
-
- 20 Agu, 2002 19 kayıt (commit)
-
-
Raymond Hettinger yazdı
-
Guido van Rossum yazdı
-
Guido van Rossum yazdı
tiny amount of code duplication, but makes it possible to give BaseSet an __init__ that raises an exception.
-
Guido van Rossum yazdı
-
Guido van Rossum yazdı
received feedback that was based in the misunderstanding that sets were sequences.
-
Guido van Rossum yazdı
This patch causes CGIHTTPServer to update os.environ regardless of how it tries to handle calls (fork, popen*, etc.). Backport bugfix candidate.
-
Tim Peters yazdı
SHIFT and MASK, and widen digit. One problem is that code of the form digit << small_integer implicitly assumes that the result fits in an int or unsigned int (platform-dependent, but "int sized" in any case), since digit is promoted "just" to int or unsigned via the usual integer promotions. But if digit is typedef'ed as unsigned int, this loses information. The cure for this is just to cast digit to twodigits first.
-
Guido van Rossum yazdı
These were reported and fixed by Inyeol Lee in SF bug 595350. The endswith() bug was already fixed in 2.3, but this adds some more test cases.
-
Michael W. Hudson yazdı
-
Michael W. Hudson yazdı
-
Barry Warsaw yazdı
-
Barry Warsaw yazdı
-
Barry Warsaw yazdı
2045, section 5.2 states that if the Content-Type: header is syntactically invalid, the default type should be text/plain. Implement minimal sanity checking of the header -- it must have exactly one slash in it. This closes SF patch #597593 by Skip, but in a different way. Note that these methods used to raise ValueError for invalid ctypes, but now they won't.
-
Barry Warsaw yazdı
get the MIME main and sub types, instead of getting the whole ctype and splitting it here. The two more specific methods now correctly implement RFC 2045, section 5.2.
-
Tim Peters yazdı
signed vs unsigned).
-
Fred Drake yazdı
Closes SF bug #597177.
-
Barry Warsaw yazdı
email 2.2 but fails in email 1.0.
-
Andrew M. Kuchling yazdı
(There's a link to PEP218; has PEP218 been updated to match the actual module implementation?)
-
Andrew M. Kuchling yazdı
the list is getting awfully long Mention Karatsuba multiplication and some other items
-
- 19 Agu, 2002 14 kayıt (commit)
-
-
Neal Norwitz yazdı
-
Fred Drake yazdı
dict.items/keys/values/iteritems/iterkeys/itervalues().
-
Guido van Rossum yazdı
interning. I modified Oren's patch significantly, but the basic idea and most of the implementation is unchanged. Interned strings created with PyString_InternInPlace() are now mortal, and you must keep a reference to the resulting string around; use the new function PyString_InternImmortal() to create immortal interned strings.
-
Guido van Rossum yazdı
-
Guido van Rossum yazdı
in LOAD_GLOBAL. Besides saving a C function call, it saves checks whether f_globals and f_builtins are dicts, and extracting and testing the string object's hash code is done only once. We bail out of the inlining if the name is not exactly a string, or when its hash is -1; because of interning, neither should ever happen. I believe interning guarantees that the hash code is set, and I believe that the 'names' tuple of a code object always contains interned strings, but I'm not assuming that -- I'm simply testing hash != -1. On my home machine, this makes a pystone variant with new-style classes and slots run at the same speed as classic pystone! (With new-style classes but without slots, it is still a lot slower.)
-
Guido van Rossum yazdı
comments everywhere that bugged me: /* Foo is inlined */ instead of /* Inline Foo */. Somehow the "is inlined" phrase always confused me for half a second (thinking, "No it isn't" until I added the missing "here"). The new phrase is hopefully unambiguous.
-
Guido van Rossum yazdı
to _PyType_Lookup().
-
Guido van Rossum yazdı
Should save 4% on slot lookups.
-
Michael W. Hudson yazdı
Move some debugging checks inside Py_DEBUG. They were causing cache misses according to cachegrind.
-
Guido van Rossum yazdı
This causes a modest speedup.
-
Guido van Rossum yazdı
-
Guido van Rossum yazdı
convert the doc strings to LaTeX, be my guest.)
-
Guido van Rossum yazdı
-
Guido van Rossum yazdı
expensive and overly general PyObject_IsInstance(), call PyObject_TypeCheck() which is a macro that often avoids a call, and if it does make a call, calls the much more efficient PyType_IsSubtype(). This saved 6% on a benchmark for slot lookups.
-