Hrvoje Niksic wrote:
> On 10/19/2012 03:22 AM, Benjamin Peterson wrote:
>> It would be interesting to see how common it is for strings which have
>> their hash computed to be compared.
>
> Since all identifier-like strings mentioned in Python are interned, and
> therefore have had their hash co
Hrvoje Niksic wrote:
> Assume a UTF-8 locale. A file named b'\xff', being an invalid UTF-8
> sequence, will be converted to the half-surrogate '\udcff'. However,
> a file named b'\xed\xb3\xbf', a valid[1] UTF-8 sequence, will also be
> converted to '\udcff'. Those are quite different POSIX p
Andrea Griffini wrote:
> On Wed, Apr 8, 2009 at 12:57 PM, Jack diederich
> wrote:
>> You wrote a program to find the two smallest ints that would have a
>> hash collision in the CPython set implementation? I'm impressed.
>> And by impressed I mean frightened.
>
> ?
>
> print set([0,8]).pop(
tav wrote:
> I explain in detail in this blog article:
>
> http://tav.espians.com/ruby-style-blocks-in-python.html
>
"This is also possible in Python but at the needless cost of naming and
defining a function first"
The cost of defining the function first is probably much less than the cos
"Steven D'Aprano" <[EMAIL PROTECTED]> wrote:
> It would be nice to be able to do this:
>
> defaults = dict(a=5, b=7)
> f(**defaults, a=8) # override the value of a in defaults
>
> but unfortunately that gives a syntax error. Reversing the order would
> override the wrong value. So as Python ex
"Steven D'Aprano" <[EMAIL PROTECTED]> wrote:
> On Mon, 12 May 2008 08:20:51 am Georg Brandl wrote:
>> I believe the following is a common use-case for enumerate()
>> (at least, I've used it quite some times):
>>
>> for lineno, line in enumerate(fileobject):
>> ...
>>
>> For this, it would be
Dimitrios Apostolou <[EMAIL PROTECTED]> wrote:
> On another note which sorting algorithm is python using? Perhaps we can
> add this as a footnote. I always thought it was quicksort, with a worst
> case of O(n^2).
See http://svn.python.org/projects/python/trunk/Objects/listsort.txt
Greg Ewing <[EMAIL PROTECTED]> wrote:
> Fred Drake wrote:
>>@property
>>def attribute(self):
>>return 42
>>
>>@property.set
>>def attribute(self, value):
>>self._ignored = value
>
> Hmmm... if you were allowed general lvalues as the target
"Steven Bethard" <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]:
> On 10/31/07, Fred Drake <[EMAIL PROTECTED]> wrote:
>> If I had to choose built-in names, though, I'd prefer "property",
>> "propset", "propdel". Another possibility that seems reasonable
>> (perhaps a bit better) would be:
>>
"tomer filiba" <[EMAIL PROTECTED]> wrote in
news:[EMAIL PROTECTED]:
> why not add __enter__ and __exit__ to generator objects?
> it's really a trivial addition: __enter__ returns self, __exit__ calls
> close().
> it would be used to ensure close() is called when the generator is
> disposed, inste
"Neal Norwitz" <[EMAIL PROTECTED]> wrote in
news:[EMAIL PROTECTED]:
> I just checked in a whitespace normalization change that was way too
> big. Should this task be automated?
IMHO, changing whitespace retrospectively in a version control system is a
bad idea.
How much overhead would it be t
"Terry Reedy" <[EMAIL PROTECTED]> wrote in
news:[EMAIL PROTECTED]:
>
> "Duncan Booth" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
>> There's a thread on comp.lang.python at the moment under the subject
>> "It
There's a thread on comp.lang.python at the moment under the subject "It is
__del__ calling twice for some instances?" which seems to show that when
releasing a long chain of old-style classes every 50th approximately has
its finaliser called twice. I've verified that this happens on both Python
Thomas Heller <[EMAIL PROTECTED]> wrote in
news:[EMAIL PROTECTED]:
>> /* if no docstring given and the getter has one, use that one */
>> if ((doc == NULL || doc == Py_None) && get != NULL &&
>> PyObject_HasAttrString(get, "__doc__")) {
>> if (!(get_doc = PyObject_Ge
"Jim Jewett" <[EMAIL PROTECTED]> wrote in
news:[EMAIL PROTECTED]:
> As a strawman proposal:
>
> deletes = [(obj.__del__.cycle, obj) for obj in cycle
> if hasattr(obj, "__del__") and
> hasattr(obj.__del__, "cycle")]
> deletes.sort()
> for (cycle, obj) in dele
Georg Brandl <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]:
> Unfortunately, a @property decorator is impossible...
>
It all depends what you want (and whether you want the implementation to be
portable to other Python implementations). Here's one possible but not
exactly portable exampl
Nick Coghlan <[EMAIL PROTECTED]> wrote in
news:[EMAIL PROTECTED]:
> Duncan Booth wrote:
>> I'm not convinced by the rationale given why atime,ctime,mtime and
>> size are methods rather than properties but I do find this PEP much
>> more agreeable than the last ti
BJörn Lindqvist <[EMAIL PROTECTED]> wrote in
news:[EMAIL PROTECTED]:
> On 2/4/06, Guido van Rossum <[EMAIL PROTECTED]> wrote:
>> I won't even look at the PEP as long as it uses / or // (or any other
>> operator) for concatenation.
>
> That's good, because it doesn't. :)
> http://www.python.org/p
Stefan Rank <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]:
> I think there is no need for a special @syntax for this to work.
>
> I suppose it would be possible to allow a trailing block after any
> function invocation, with the effect of creating a new namespace that
> gets treated as co
[EMAIL PROTECTED] wrote in news:[EMAIL PROTECTED]:
> According to RFC 2396[1] section 5.2:
>
> g) If the resulting buffer string still begins with one or more
> complete path segments of "..", then the reference is
> considered to be in error. Implementations may handle t
Jim Fulton <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]:
>> No, the return sets a flag and raises StopIteration which should make
>> the iterator also raise StopIteration at which point the real return
>> happens.
>
> Only if exc is not None
>
> The only return in the pseudocode is insid
Jim Fulton <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]:
> Guido van Rossum wrote:
>> I've written a PEP about this topic. It's PEP 340: Anonymous Block
>> Statements (http://python.org/peps/pep-0340.html).
>>
> Some observations:
>
> 1. It looks to me like a bare return or a return with
22 matches
Mail list logo