Good points. Well, this is pretty academic at this point - I don't think
anyone would seriously choose to obsolete __ne__, regardless of whether it
is absolutely necessary or not.
On Mon, Jan 8, 2018 at 4:51 PM, Thomas Jollans wrote:
> On 2018-01-08 15:25, Oren Ben-Kiki wrote:
> >
Ugh, right, for NaN you can have (x < y) != (x >= y) - both would be false
if one of x and y is a NaN.
But __ne__ is still useless ;-)
On Mon, Jan 8, 2018 at 4:36 PM, Thomas Nyberg wrote:
> On 01/08/2018 03:25 PM, Oren Ben-Kiki wrote:
> > I am hard pressed to think of a case
I don't see a case in IEEE where (x == y) != !(x != y).
There _is_ a case where (x != x) is true (when x is NaN), but for such an
x, (x == x) will be false.
I am hard pressed to think of a case where __ne__ is actually useful.
That said, while it is true you only need one of (__eq__, __ne__), you
The first line says "The major reason is history." :-) But it also gives an
explanation: providing functionality for types that, at the time, didn't
have methods.
On Mon, Oct 16, 2017 at 8:33 PM, Lele Gaifax wrote:
> Oren Ben-Kiki writes:
>
> > So I still think it
erence rather than a pure technical
consideration. But that's all second-guessing, anyway. You'd have to ask
Guido what his reasoning was...
On Mon, Oct 16, 2017 at 7:36 PM, Ned Batchelder
wrote:
> On 10/16/17 12:16 PM, Oren Ben-Kiki wrote:
>
>> That doesn't explain wh
That doesn't explain why `del` isn't a method though. Intuitively,
`my_dict.delete(some_key)` makes sense as a method. Of course, you could
also make the same case for `len` being a method... and personally I think
it would have been cleaner that way in both cases. But it is a minor issue,
if at al
Yes, it sort-of makes sense... I'll basically re-post my question there.
Thanks for the link!
Oren.
On Sun, Jul 16, 2017 at 4:29 PM, Peter Otten <__pete...@web.de> wrote:
> Oren Ben-Kiki wrote:
>
> > TL;DR: We need improved documentation of the way meta-classes behave
TL;DR: We need improved documentation of the way meta-classes behave for
generic classes, and possibly reconsider the way "__setattr__" and
"__getattribute__" behave for such classes.
I am using meta-programming pretty heavily in one of my projects.
It took me a while to figure out the dance betwe
You _can_ just extend a JSON file without loading it, but it will not be
"fun".
Say the JSON file contains a top-level array. The final significant
character in it would be a ']'. So, you can read just a reasonably-sized
block from the end of the file, find the location of the final ']',
overwrite
| BAR
> ... SPAM = auto()
> ... HAM = auto()
> ... SPAMHAM = SPAM | HAM
> ...
>
Ugh, good point - I didn't consider that use case, I see how it would be
nasty to implement.
I guess just improving the documentation is called for, then...
Thanks,
Oren.
--
https://mail.python.org/mailman/listinfo/python-list
#x27;m not interested in doing that. I currently have that kind of code
> in aenum[1] for 2.7 compatibility, and it's a nightmare to maintain.
>
Understood. Another alternative would be to have something like
_generate_next_value_ex_ with the additional argument (similar to
__reduce_ex__), which isn't ideal either.
Assuming you buy into my "necessity" claim, that is...
Thanks,
Oren.
--
https://mail.python.org/mailman/listinfo/python-list
it to the
documentation, we should instead remove this arbitrary restriction from the
implementation, and only modify the documentation to clarify this
restriction is gone.
Oren.
On Mon, Apr 3, 2017 at 8:38 AM, Chris Angelico wrote:
> On Mon, Apr 3, 2017 at 2:49 PM, Oren Ben-Kiki
> wrote:
&
` will invoke `_generate_next_value_` with the
concatenation of both lists (following values first, preceding values
second), to maximize compatibility with existing code.
Thanks,
Oren Ben-Kiki
--
https://mail.python.org/mailman/listinfo/python-list
d intended), I
want to reiterate that the criticism is well-taken as a cultural
matter. I just don't want everyone to think I'm bloody insane or that
I'm not aware this is playing with fire. Maybe we can put it in module
"YesImSureJustBloodyDoItAlreadyGoddamnit" and prints a
ny parsing, interpreting or other
complications that would arise.
I appreciate any feedback, including frank statements that you'd
rather not trifle with such nonsense.
~Oren
[1] http://www.google.com/codesearch?q=except%3A\spass&hl=en
[2] http://www.google.com/codesearch?hl=en&lr=&q=silence+lang%3Apy
--
http://mail.python.org/mailman/listinfo/python-list
On Jul 26, 4:34 pm, Stefan Behnel <[EMAIL PROTECTED]> wrote:
> [EMAIL PROTECTED] wrote:
> > On Jul 26, 3:13 pm, John Machin <[EMAIL PROTECTED]> wrote:
> >> On Jul 26, 9:24 pm, [EMAIL PROTECTED] wrote:
>
> >>> OK, I solved the problem but I still don't get what went wrong.
> >>> Solution - use tree
On Jul 26, 3:13 pm, John Machin <[EMAIL PROTECTED]> wrote:
> On Jul 26, 9:24 pm, [EMAIL PROTECTED] wrote:
>
> > OK, I solved the problem but I still don't get what went wrong.
> > Solution - use tree builder in order to create the new xml file
> > (previously I was "manually" creating it).
>
> > I
;m doing something wrong
and I'd love to learn what.
the toy script:
http://staff.science.uva.nl/~otsur/code/xmlConversions.py
Thaks for all your help,
Oren
--
http://mail.python.org/mailman/listinfo/python-list
> How about trying
> root = ElementTree.parse(urlopen(query), encoding ='utf-8')
>
this specific thing is not working, however, parsing the url is not
problematic. the problem is that after parsing the xml at the url I
save some of the fields to a local file and the local file is not
being parsed
as '&'
>
> Either the originator of the XML has messed up, or whatever
> you have done to save a local copy has mangled it.
I think i made a mess. I changed the '&' in the original response to
'and' because the parser failed to parse the '
(this question was also posted in the devshed python forum:
http://forums.devshed.com/python-programming-11/parsing-xml-with-elementtree-unicode-problem-461518.html
).
-
(it's a bit longish but I hope I give all the information)
1. here is my problem: I'm trying to par
> We are using the stored procedure to do a If Exist, update, else Insert
> processing for
> each record.
Consider loading the data in batches into a temporary table and then
use a single insert statement to insert new records and a single update
statement to update existing ones. This way, you a
g this drives is set
correctly (including time zone) you can store just a single timestamp
and compare for files or directories modified after that time.
Otherwise you will need to store and compare for any changes, not just
going forward.
Oren
--
http://mail.python.org/mailman/listinfo/python-list
Bryan Olson wrote:
> I recently wrote a module supporting value-shared slicing. I
> don't know if this functionality already existed somewhere,
In the Numarray module slices are a view into the underlying array
rather than a copy.
http://www.stsci.edu/resources/software_hardware/numarray
--
htt
> IIRC, many of the mailbox modules (such as mailbox and
> mhlib) are read-only, but they should provide a good starting point.
The mailbox module has recently been upgraded for full read-write
access by a student participating in google's Summer of Code. It is
currently under review for inclusion
Russell E. Owen wrote:
> I have several situations in my code where I want a unique identifier
> for a method of some object (I think this is called a bound method). I
> want this id to be both unique to that method and also stable (so I can
> regenerate it later if necessary).
>>> def persistent_
g someone to do it. It's not a big project so it shouldn't be too
expensive.
Oren
--
http://mail.python.org/mailman/listinfo/python-list
It is relatively easy to write voice applications for the Asterisk
software PBX using the CGI-like AGI (Asterisk Gateway Interface).
The following document describes the AGI and has some examples in
Python:
http://home.cogeco.ca/~camstuff/agi.html
--
http://mail.python.org/mailman/listinfo/pyth
filesystem but on linux and BSDs I find that
performance easily rivals that of berkeleydb and initialization time is
much faster. This "database" also supports reliable concurrent access
by multiple threads or processes.
See http://www.tothink.com/python/linkdb
Oren
--
http://mail.python.org/mailman/listinfo/python-list
http://tothink.com/python/progman/
This module implements BASIC-like NEW, LOAD, RUN (sorry, no SAVE...).
Oren
--
http://mail.python.org/mailman/listinfo/python-list
See the frozendict recipe:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/414283
It was written exactly for this purpose: a dictionary that can be a
member in a set.
Oren
--
http://mail.python.org/mailman/listinfo/python-list
> you forgot
>
>http://effbot.org/zone/element-infoset.htm
>
> which describes the 3-node XML infoset subset used by ElementTree.
No, I did not forget your infoset subset. I was comparing it with other
infoset subsets described in various XML specifications.
I agree 100% that prefixes were no
Fredrik Lundh wrote:
> Chris Spencer wrote:
>
> > If an XML parser reads in and then writes out a document without having
> > altered it, then the new document should be the same as the original.
>
> says who?
Good question. There is no One True Answer even within the XML
standards.
It all boils
gt; with locking(mutex), opening(readfile) as input:
> ...
+1, and add PEP-328-like parentheses for multiline.
Oren
--
http://mail.python.org/mailman/listinfo/python-list
... )
>>> ElementTree.dump(e)
http://some.uri";>contentyzsome text
Note that the namespace prefix on output is not "ns0". The second
argument to the Namespace constructor is the prefix hint and unless it
collides with any other namespace or prefix it will be added to
_namespace_map dictionary and used on output.
Oren
--
http://mail.python.org/mailman/listinfo/python-list
to ... keys which ..." -> "for key in"
"keys from a dictionary" -> "set(dictionary)"
"not found in a specific set" -> "-specificset"
"... remove keys ..." -> "del dictionary[key]&quo
See also the thread resulting from Andrey Tatarinov's original
proposal (using the keyword "where"):
http://groups.google.co.uk/groups?selm=3480qqF46jprlU1%40individual.net
Oren
--
http://mail.python.org/mailman/listinfo/python-list
"Jordan Rastrick" <[EMAIL PROTECTED]> wrote in message news:<[EMAIL
PROTECTED]>...
> Hmmm, I like the terminology consumers better than acceptors.
Here's an implementation of Python consumers using generators:
http://groups.google.co.uk/[EMAIL PROTECTED]
O
e new and
old-style classes a bit differently.
Note that this kind of function may declare globals. They will be
persistent but private to the function.
Oren
--
http://mail.python.org/mailman/listinfo/python-list
ue and False if not found so it can run on Python 2.2.
Oren
--
http://mail.python.org/mailman/listinfo/python-list
iterating over a file but it
messed up the underlying file object's state so it still wasn't
reiterable. But when iter() returns the same object - well, that's a
sign that the object is definitely not reiterable.
Oren
--
http://mail.python.org/mailman/listinfo/python-list
hat "w =
Widget(**locals()) where:" would produce the wrong result as it will
include all the values in the containing scope, not just those defined
in the where block.
Oren
--
http://mail.python.org/mailman/listinfo/python-list
42 matches
Mail list logo