Re: Why does __ne__ exist?

2018-01-08 Thread Oren Ben-Kiki
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: > >

Re: Why does __ne__ exist?

2018-01-08 Thread Oren Ben-Kiki
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

Re: Why does __ne__ exist?

2018-01-08 Thread Oren Ben-Kiki
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

Re: why del is not a function or method?

2017-10-16 Thread Oren Ben-Kiki
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

Re: why del is not a function or method?

2017-10-16 Thread Oren Ben-Kiki
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

Re: why del is not a function or method?

2017-10-16 Thread Oren Ben-Kiki
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

Re: Difference in behavior of GenericMeta between 3.6.0 and 3.6.1

2017-07-16 Thread Oren Ben-Kiki
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

Difference in behavior of GenericMeta between 3.6.0 and 3.6.1

2017-07-16 Thread Oren Ben-Kiki
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

Re: Appending data to a json file

2017-04-03 Thread Oren Ben-Kiki
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

Re: Behavior of auto in Enum and Flag.

2017-04-03 Thread Oren Ben-Kiki
| 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

Re: Behavior of auto in Enum and Flag.

2017-04-03 Thread Oren Ben-Kiki
#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

Re: Behavior of auto in Enum and Flag.

2017-04-02 Thread Oren Ben-Kiki
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: &

Behavior of auto in Enum and Flag.

2017-04-02 Thread Oren Ben-Kiki
` 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

Re Interest check in some delicious syntactic sugar for "except:pass"

2010-03-03 Thread Oren Elrad
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

Interest check in some delicious syntactic sugar for "except:pass"

2010-03-03 Thread Oren Elrad
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

Re: Parsing XML with ElementTree (unicode problem?)

2007-07-26 Thread oren . tsur
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

Re: Parsing XML with ElementTree (unicode problem?)

2007-07-26 Thread oren . tsur
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

Re: Parsing XML with ElementTree (unicode problem?)

2007-07-26 Thread oren . tsur
;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

Re: Parsing XML with ElementTree (unicode problem?)

2007-07-24 Thread oren . tsur
> 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

Re: Parsing XML with ElementTree (unicode problem?)

2007-07-23 Thread oren . tsur
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 '

Parsing XML with ElementTree (unicode problem?)

2007-07-23 Thread oren . tsur
(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

Re: Inserting Records into SQL Server - is there a faster interface than ADO

2005-11-14 Thread Oren Tirosh
> 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

Re: Is it possible to detect if files on a drive were changed without scanning the drive?

2005-09-12 Thread Oren Tirosh
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

Re: Virtual Slicing

2005-08-27 Thread Oren Tirosh
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

Re: Email client in Pyhton

2005-08-25 Thread Oren Tirosh
> 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

Re: How to get a unique id for bound methods?

2005-08-22 Thread Oren Tirosh
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_

Re: JBUS and Python which way

2005-08-02 Thread Oren Tirosh
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

Re: voicemail program written with python

2005-06-22 Thread Oren Tirosh
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

Re: Python choice of database

2005-06-20 Thread Oren Tirosh
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

Re: 1980's Home Computer-style Package.

2005-06-17 Thread Oren Tirosh
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

Re: Set of Dictionary

2005-06-17 Thread Oren Tirosh
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

Re: ElementTree Namespace Prefixes

2005-06-14 Thread Oren Tirosh
> 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

Re: ElementTree Namespace Prefixes

2005-06-13 Thread Oren Tirosh
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

Re: For review: PEP 343: Anonymous Block Redux and Generator Enhancements

2005-06-04 Thread oren . tirosh
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

Re: ElemenTree and namespaces

2005-05-16 Thread oren . tirosh
... ) >>> 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

Re: Removing dictionary-keys not in a set?

2005-04-18 Thread Oren Tirosh
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

Re: pre-PEP: Suite-Based Keywords

2005-04-16 Thread Oren Tirosh
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

Re: Suggesting a new feature - "Inverse Generators"

2005-03-26 Thread Oren Tirosh
"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

Re: Turn of globals in a function?

2005-03-26 Thread Oren Tirosh
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

Re: managing multiple subprocesses

2005-02-07 Thread Oren Tirosh
ue and False if not found so it can run on Python 2.2. Oren -- http://mail.python.org/mailman/listinfo/python-list

Re: Word for a non-iterator iterable?

2005-02-07 Thread Oren Tirosh
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

Re: python3: 'where' keyword

2005-01-08 Thread oren
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