f



Python 3.3 can't sort memoryviews as they're unorderable

http://docs.python.org/dev/whatsnew/3.3.html states "memoryview 
comparisons now use the logical structure of the operands and compare 
all array elements by value".  So I'd have thought that you should be 
able to compare them and hence sort them, but this is the state of play.

Python 3.3.0 (v3.3.0:bd8afb90ebf2, Sep 29 2012, 10:55:48) [MSC v.1600 32 
bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
 >>> memoryview(bytearray(range(5))) == memoryview(bytearray(range(5)))
True
 >>> memoryview(bytearray(range(5))) != memoryview(bytearray(range(5)))
False
 >>> memoryview(bytearray(range(5))) < memoryview(bytearray(range(5)))
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
TypeError: unorderable types: memoryview() < memoryview()

Okay then, let's subclass memoryview to provide the functionality.

 >>> class Test(memoryview):
....     pass
....
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
TypeError: type 'memoryview' is not an acceptable base type

Oh dear. 
http://docs.python.org/py3k/library/stdtypes.html#typememoryview only 
gives examples of equality comparisons and there was nothing that I 
could see in PEP3118 to explain the rationale behind the lack of other 
comparisons.  What have I missed?

-- 
Cheers.

Mark Lawrence.

0
breamoreboy1 (1156)
10/21/2012 11:24:32 AM
comp.lang.python 77058 articles. 6 followers. Post Follow

0 Replies
635 Views

Similar Articles

[PageSpeed] 39

Reply:

Similar Artilces:

Python 3.3 can't find PySide
Hi everybody, I'm just starting to dabble in Python development after spending years with C# and Java, but there's one small thing holding me back: I can't seem to get PySide working for the life of me. Let me explain: I'm on OS X 10.6.8 and have installed Python 3.3.0 and Qt 4.8.4 with Homebrew. The Python interpreter works fine, and all the Qt utilites are in my $PATH and installed correctly. Homebrew has a package for PySide, but it's only compiled against Python 2.x instead of 3.x (there is an issue about this, https://github.com/mxcl/homebrew/issues/16439), so I can't use that. I tried using the PySide BuildScripts on GitHub, but those fail with an error that I can't seem to resolve (I'll save that for a PySide list, I guess). I can't compile it manually because I don't have the expertise to pass the right options to cmake and tell it where to find all my Python stuff, so I'm really at my wit's end. I tried installing the Homebrew PySide package anyways, but putting the PySide directory (with __init__.py) in my PYTHONPATH didn't allow me to import anything from PySide; I guess this means that PySide has to be told to compile for 3.x instead of 2.x. My question: is there anybody who has had success installing PySide on OS X for Python 3.x? There must be a way, I must be missing something... right? I'll try to find a more relevant PySide list or something to pose this ...

Re: Re: python 2.3.3 setup.py: why adding sys.prefix to include_dir, libdir? ['LBBW': checked]
I am restricted to using Lotus Notes right now, so I try to make my comments recognizable with ### > ... > I understand the --prefix=3DPREFIX sets the installation _target_ directory. > Does it make sense to have these paths in include_dirs/library_dirs? Wh= y > would I want this? Well, to work completely out of the box setup.py would need to be telepathic, omniscient and be able to see into the future. We're working on that <wink>, but not there yet. So I wouldn't regard having to hand-hack setup.py as being in particularly bad taste. ### Nothing against hand-ha...

Can't use python plugin in gimp 2.3.3
I compiled gimp - 2.3.3 from source in "/opt/gimp" . But the python plugin can not work, such as [image] -> Filters -> "Drop shadow and bevel" can not work, but the plugin can display. I compiled with ------ $sudo ./configure --prefix=/opt/gimp --disable-print && make && make install ------ debugis: ------ This is a development version of The GIMP. Debug messages may appear here. Traceback (most recent call last): File "/opt/gimp/lib/gimp/2.0/python/gimpfu.py", line 503, in response dialog.res = run_script(params) File "...

i can't insert 'a''a' in a field with size 3
hi, i run INSERT INTO test (FIELD1) VALUES ('a''a') but DBMS oracle returns this error: ORA-01401: inserted value too large for column (FIELD1 size is 3!) what's the error? Fici wrote: > hi, > i run > INSERT INTO test (FIELD1) VALUES ('a''a') > but DBMS oracle returns this error: > ORA-01401: inserted value too large for column > (FIELD1 size is 3!) > what's the error? SQL> create table test ( 2 field1 VARCHAR2(3)); Table created. SQL> INSERT INTO test 2 (field1) 3 VALUES 4 ('a''a'); 1 row created. SQL> SELECT * FROM test; FIE --- a'a SQL> try the following in SQL*Plus: show define Post the result If you are not using SQL*Plus then your front-end tool is defective or needs to be reconfigured. -- Daniel A. Morgan Oracle Ace Director & Instructor University of Washington damorgan@x.washington.edu (replace x with u to respond) Puget Sound Oracle Users Group www.psoug.org On Mar 10, 6:38 pm, Fici <moretto.feder...@gmail.com> wrote: > hi, > i run > INSERT INTO test (FIELD1) VALUES ('a''a') > but DBMS oracle returns this error: > ORA-01401: inserted value too large for column > (FIELD1 size is 3!) > what's the error? Might be one of unicode charsets having each symbol more than one byte and column size defined in bytes not chars. Check DB charset and...

open('.', 'rb') on python 2.3
Hi, Simple code fails in python 2.3: [root@maja rdiff-backup]# python Python 2.3 (#1, Jul 31 2003, 10:41:08) [GCC 3.3 (PLD Linux)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import os >>> fp = open('.', 'rb') Traceback (most recent call last): File "<stdin>", line 1, in ? IOError: [Errno 21] Is a directory but works in 2.2 [arekm@perfo arekm]$ python Python 2.2.2 (#1, Dec 28 2002, 23:32:35) [GCC 2.95.4 20010319 (prerelease)] on linux2 Type "help", ...

3*x''+(10^-3)*x'+123*x=2*cos(3*t); x=x(t);initial conditions x(0)=0 and x'(0)=0
Hi everybody, I need to solve the Cauchy problem written in the title box ( I paste it here again ): 3*x''+(10^-3)*x'+123*x=2*cos(3*t); x=x(t);initial conditions x(0)=0 and x'(0)=0. I tried with Runge-Kutta method and it seems to work as the solution x(t) is the same that I can get solving the equation by myself. I need to know if it would be better another method (eventually multistep one) and why it would be better (please don't just tell me 'cause it's faster or so...I need to know the why too). As last thing I need to estimate the error committed with Runge...

Re: Do this. Don't do that. Can't you read the signs? #3
Excel?? word processor? There are pencils and paper sheets! Good enough for storing text and calculate everything what's needed! What? They need word processors and Excel to produce pencils and paper??? Ok, stones, chisel and hammer!! Or ropes with hitchs ... You see, there is a solution - unfortunately it might not fit to the problem... I use the best tools with certainly the best methods (I'm really sure!), but I've got still no solution! Think I have to come back on monday and continue trying... Have a nice weekend! Gerhard On Fri, 14 Aug 2009 13:30:51 -0400, Nathaniel W...

Is there any difference between print 3 and print '3' in Python ?
I know the print statement produces the same result when both of these two instructions are executed ,I just want to know Is there any difference between print 3 and print '3' in Python ? On Mon, Mar 26, 2012 at 10:45 PM, <redstone-cold@163.com> wrote: > I know the print statement produces the same result when both of these two instructions are executed ,I just want to know Is there any difference between print 3 and print '3' in Python ? One of them takes the integer 3, converts it into a string, and prints it. The other takes the string '3' and prints it. ...

Re: if str_mo not in ('','.') and str_da not in ('','.') and str_ yy not in ('','.') Any shorter ? #3
> From: Igor Kurbeko [mailto:ikurbeko@ATHEROGENICS.COM] > I'm just curious if it ever dawned on anybody > how to abbreviate this line : > > if str_mo not in ('','.') > and str_da not in ('','.') > and str_yy not in ('','.') %*in autoexec:; %Let Blank = Blank; %Let Invalid = Invalid; %*in aFormat; PROC Format; value $StrValu %*somevalues = 'ok'; '','.' = "&Blank." %* other = "&Invalid."; ; %*in Program; if put(Str_...

RE: [ace-users] Re: ACE 5.4.0 won't compile after GCC upgrade (3.3.3 -> 3.4.3)
Hi Tom, > > > The "resolution" was to upgrade to ACE-5.4.3 or later, which has > > > code fixes to help with the newer compiler. Not sure how > much would > > > need to change, but you may be able to inspect the differences in > > > that part of the code wrt the newer ACE release to backport the > > > fixes. > > Thanks, I've downloaded and am building. Is ACE-5.4.3 the latest > > production release ? > > Well, the definition of "production release" for ACE is a bit murky > imho. Production release is one with 2 numbers. E.g., 5.4 > The developers on this list (almost) always recommend using the > latest package, which is typically labeled a "beta release". > The latest > would be 5.4.4. The developers always recommend *not* using the > "production release", since the next release labeled "beta" > is always a bug-fix-only release. I believe I qualify as a "developer", but have a different take. Production releases are tested well, and often better than the BFO beta. There may be fixes in BFO, but there may be additional bugs also - it happened at 5.4.1. For those wishing to adopt a version of ACE and stick with it, you'll need a version you can get support (fixes and advice) for. For example, Riverace supports releases (e.g., 5.4) and fix kits that Riverace releases for those (i...

Python 3.3.0a4, please add ru'...'
Please consistency. >>> sys.version '3.3.0a4 (v3.3.0a4:7c51388a3aa7+, May 31 2012, 20:15:21) [MSC v.1600 32 bit (Intel)]' >>> 'a' 'a' >>> b'a' b'a' >>> br'a' b'a' >>> rb'a' b'a' >>> u'a' 'a' >>> ur'a' 'a' >>> ru'a' SyntaxError: invalid syntax >>> jmf On Sat, 16 Jun 2012 10:36:42 -0700, jmfauth wrote: > Please consistency. There is no point asking here. Feature requests a...

RE: [ace-users] Re: ACE 5.4.0 won't compile after GCC upgrade (3.3.3 -> 3.4.3) #2
Hi J.T., Right... The issue is a bit odd... Here's the check I added for ACE: dnl This check was added to work around a system-supplied header dnl (/usr/include/netinet/ip.h) that won't compile with Visual Age C++ dnl unless the _NO_BITFIELDS preprocessor macro is defined. The comments dnl there recommend use of _NO_BITFIELDS (and recode where needed to allow dnl that), but we won't just turn it on. Check to see if it's needed. Note dnl that this check is related to headers but done before we really know if dnl the header is present. Thus, if the bare compile fails, but succeeds dnl with _NO_BITFIELDS, set the flag, else leave things alone. -Steve -- Steve Huston, Riverace Corporation Adding Service to Open Source Software ACE book info at http://www.riverace.com/acebooks/ > -----Original Message----- > From: J.T. Conklin [mailto:jtc@acorntoolworks.com] > Sent: Wednesday, April 13, 2005 2:21 PM > To: Colm McHugh > Cc: Steve Huston; ace-users@cs.wustl.edu > Subject: Re: [ace-users] Re: ACE 5.4.0 won't compile after > GCC upgrade (3.3.3 -> 3.4.3) > > > Colm McHugh <cmchugh@callixa.com> writes: > >>Sure... Why do you say <sys/machine.h> is a prerequisite for > >><netinet/tcp.h>? I addressed a problem related to this in > the autoconf > >>support for AIX that'll go in the next beta, but it doesn't involve...

Re: 'do over' doesn't work #3
On Sat, 24 Jan 2009 14:25:41 +0000, karma <dorjetarap@GOOGLEMAIL.COM> wrote: >Hi Ash, > >What is the purpose of your code? Looking at the test data it appears >you want to replace missing numeric values with the number zero and >missing character data with a "Z". Replacing missing numerics with >zero seems like a pretty standard thing, and therefore there are a few >ways to handle this in SAS. Yes. See http://www.sascommunity.org/wiki/Generating_Zeroes_in_PROC_TRANSPOSE_Output or http://tinyurl.com/abozdc >Replacing missing character variables with &g...

Re: Why can't OpenBSD's securelevels be saved?! #3
Anonyma wrote: > Anonymous wrote: > >> Bearing in mind the issues: >> >> [http://www.redteam-pentesting.de/advisories/rt-sa-2005-15.txt] >> >> AND Theo's attitude , >> >> "Sorry, we are going to change nothing. Securelevels are useless." >> > > Clever Monkey wrote: > >> ...and notice that neither of the other platforms had anything better to >> say on the matter. Clearly no one is going to fix this broken model. >> Theo is just not bothering to sugar-coat it. > > *** ...

Re: Can't get rid of 3 files on MPE #3
FSCHECK, A.05.00. (C) Hewlett-Packard Co., 1987. All rights reserved. fscheck: PURGEFILE X0009722.MAILTOGO.COMPL *Error: Purgefile failed. Directory error= $FFFE0000. (fscheck 22) fscheck: fscheck: CHECKFILE X0009722.MAILTOGO.COMPL Error return from Flabelinfo for X0009722.MAILTOGO.COMPL. I've asked my ops manager, richard, to raise this with HP support. (: Thanks G�nter. -----Original Message----- From: G�nter Kuhn [mailto:Guenter.Kuhn@ssd-it.ch] Sent: 15 July 2004 12:26 To: Tony Summers Cc: HP3000-L@RAVEN.UTC.EDU Subject: Re: Can't get rid of 3 files on MP...

IDLE won't run after installing Python 3.3 in Windows
The next adventure in Python was to install Python 3 into a Windows XP mach= ine. I had a previous 2.7 installation that I uninstalled and carefully rem= oved all traces of from the directory and the registry. I got the 'python-3.3.3.msi' from Python.org and installed it. From a comma= nd window I can run 'python' and I get the Python prompt. I have several Py= thon programs on the machine. If I right click o one, I have the option of = 'Edit in IDLE'. If I do that, the disk light blinks briefly, and then nothi= ng. So I went into the \python33\lib\idlelib directory and from a CMD windo= w, ran 'python idle.py'. That loads IDLE. but when I ask IDLE to load a fil= e, it navigates to a FileOpen dialog and then closes everything when I actu= ally open the file. I then tried the same thing but used 'pythonw' instead.= Same deal. I also saw some other threads here about how Python can get befuddled by fi= rewalls, so I disabled that with no effect. Any suggestions? Thanks in advance! Howard On Tuesday, February 18, 2014 6:26:51 PM UTC+3:30, eglows...@gmail.com wrot= e: > The next adventure in Python was to install Python 3 into a Windows XP ma= chine. I had a previous 2.7 installation that I uninstalled and carefully r= emoved all traces of from the directory and the registry. >=20 >=20 >=20 > I got the 'python-3.3.3.msi' from Python.org and installed it. From a com= mand window I ca...

Why Python 4.0 won't be like Python 3.0
A blog from Nick Coghlan http://www.curiousefficiency.org/posts/2014/08/python-4000.html that should help put a few minds to rest. -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence On 2014-08-17, Mark Lawrence <breamoreboy@yahoo.co.uk> wrote: > A blog from Nick Coghlan > http://www.curiousefficiency.org/posts/2014/08/python-4000.html that > should help put a few minds to rest. I agree with the comments that the appellation for "simply the next version after 3.9" should be 3....

Dr. Dobb's Python-URL!
QOTW: "The security 'droids have decided that since the MS Office Suite is a 'standard' application then software written in MS Office VBA must be 'safe.' Any other development environments (such as Java, Perl, Cygwin) are 'unsafe' and can't be installed." - Peter Olsen "There's nothing wrong with open source projects catering to a market, and there's nothing wrong with running open source software on a proprietary operating system." - Steve Holden Efficiently running a regex over a large file: http://groups-bet...

[ace-users] Re: ACE 5.4.0 won't compile after GCC upgrade (3.3.3 -> 3.4.3)
Hi Tom, > Well, the definition of "production release" for ACE is a bit murky > imho. Please see http://www.cs.wustl.edu/~schmidt/ACE_wrappers/docs/ACE-development-process.html for the canonical definition of terms. If there's something unclear there please let me know and I'll fixit. > The developers on this list (almost) always recommend using the > latest package, which is typically labeled a "beta release". Right, the reason we do that is because the "latest release" (which is most commonly a beta release) is the only thing the DOC group developers "support". > The latest would be 5.4.4. The developers always recommend *not* > using the "production release", since the next release labeled > "beta" is always a bug-fix-only release. So I usually use the x.x.1 > release (the BFO release) but would probably recommend using 5.4.4 > on any platform, as do the developers. I think you probably know this already, but for the benefit of others on the mailing list the DOC grou doesn't actually support *anything* officially for non-sponsors, i.e., our work is all on a "best effort or no effort at all" basis, as per the explanation in http://www.cs.wustl.edu/~schmidt/ACE_wrappers/docs/ACE-bug-process.html However, some companies like Riverace, OCI, PrismTech, etc. use our "official" (i.e., non-beta) releases as the basis f...

can't install Python 3.5 on windows
This is a multipart message in MIME format. ------=_NextPart_000_0001_01D101C9.700A1BE0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Dear Python: I have been trying to install Python on my Windows computer. I tried both Python 2.7 and 3.5. No luck with either one. If I try to run Python I get a message asking me if I want to repair Python. The program never runs. Can you help? -Jay Brown Jay C. Brown Department of Microbiology, Immunology and Cancer Biology University of Virginia Health System Charlottesville, VA ...

Displaying Table Field in a report's title-bar ??? don't say it can't |3 done.
I have a Report and am trying to display some Fields from the table that the Report is producing in the title-bar of the window. I try things like: Me.Caption = [TABLE_NAME].[FIELD1] + " " [TABLE_NAME].[FIELD2] I want it to display the first and last name of the person the report is about in the title-bar -- because the data is used for a servay. The name can't be printed--but I'd like it to display in the title bar so that the end user can match the names together. How could I code this in Access? I get alot of wierd errors trying 2 do this? Thanx. P.S. Is there a way to show the user a value in the report, and not allow the printer to print it. I just thought it could be cool to have the name of the person the report is about in the title-bar. I am using Access 2002, and don't mind scripting if i have to. Me.Caption = [TABLE_NAME].[FIELD1] & " " & [TABLE_NAME].[FIELD2] use the ampersand when concatenating fields, the plus sign indicates you are trying to do a mathematical operation ____________________________________________________________________________ ________ select text box you want to hide during print properties format tab display when - change from always to screen only "Franz Kafka" <Symbolics_XL1201_Sebek_Budo_Kafka@hotmail.com> wrote in message news:b3b6b110.0308231302.110cbe7a@posting.google.com... > I have a Report and am trying to display some Fields from the > table that the ...

Can't find module named 'svn' in python
Hi, i have a simple test which tries to load 'svn' moddule. # python -c "from svn import client" Traceback (most recent call last): File "<string>", line 1, in ? ImportError: No module named svn I have checked I have sub-directories 'libsvn', 'svn' under /usr/local/lib/svn-python/ cd /usr/local/lib/svn-python/ [root@localhost svn-python]# ls libsvn svn But python still can't find it. Please tell me what am I missing. I appreciate your help. My first thought: Check if you have /usr/local/lib/svn-python/ in your PYTHONPATH environme...

Re: Can't change current folder in SAS 9.1.3 #3
Another thing you could do add options to the Windows Explorer context menu so that when you right-click on a folder in the Explorer there will be an item called "SAS v9 here" that will start SAS in that specific folder. How to define it: 1. open Explorer and choose from the menu Tools, Folder options... 2. choose the tab "File types" 3. go to the entry "File Folder" in the list of "Registered file types" 4. chose edit... 5. add a new action by pushing the "New..." button, action: SAS v9 here Application used to perform action: "C...

Can't install Python 2.3 on RedHat 9
Hi, I want to eventually install plone which requires that I install python2.3. So I go to http://www.python.org/2.3.4/rpms.html and since I need RPM's for RH9 and not Fedora Core 1 I download python2.3-2.3.4-3pydotorg.src.rpm and do this .... # rpmbuild --rebuild python2.3-2.3.4-3pydotorg.src.rpm Installing python2.3-2.3.4-3pydotorg.src.rpm warning: user jafo does not exist - using root warning: group jafo does not exist - using root warning: user jafo does not exist - using root warning: group jafo does not exist - using root warning: user jafo does not exist - using root warning: gro...

Web resources about - Python 3.3 can't sort memoryviews as they're unorderable - comp.lang.python

Beta testing begins for Python 3.3.0
The beta testing phase for Python 3.3.0 has begun. Among the features 3.3.0 brings to the language are virtual environments, syntax changes for ...

Memoryview Benchmarks
There was recently a thread on cython-users which caught my eye. It has to do with memoryviews , a newway of working with memory buffers in cython. ...

Eli Bendersky's website » Articles
Articles Here I've collected links to the articles I've written online, both for this website and elsewhere. Articles published on this website ...

The Jython Project
Jython 2.7.0 Final Released (May 2015) Please see the NEWS file for detailed release notes. Read more on Frank Wierzbickis Weblog . Jython ...

Python 2.7 released
Python 2.7 brings a number of Python 3 features to the older branch and is expected to be in use in production for many years as Python developers ...

Resources last updated: 3/10/2016 8:53:17 PM