Re: Uniform Function Call Syntax (UFCS)
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info: On Sun, 08 Jun 2014 18:56:47 +0300, Marko Rauhamaa wrote: In fact, what's the point of having the duality? x y == x.__lt__(y) [...] Consider x + y. What happens? #1 First, Python checks whether y is an instance of a *subclass* of x. If so, y gets priority, otherwise x gets priority. #2 If y gets priority, y.__radd__(x) is called, if it exists. If it returns something other than NotImplemented, we are done. #3 However if y.__radd__ doesn't exist, or it returns NotImplemented, then Python continues as if x had priority. #3 If x has priority, then x.__add__(y) is called, if it exists. If it returns something other than NotImplemented, we are done. #4 However if it doesn't exist, or it returns NotImplemented, then y.__radd__(x) is called, provided it wasn't already tried in step #2. #5 Finally, if neither object has __add__ or __radd__, or both return NotImplemented, then Python raises TypeError. In a word, Python has predefined a handful of *generic functions/methods*, which are general and standard in GOOPS (Guile's object system): (define-method (+ (x string) (y string)) ...) (define-method (+ (x matrix) (y matrix)) ...) (define-method (+ (f fish) (b bicycle)) ...) (define-method (+ (a foo) (b bar) (c baz)) ...) URL: http://www.gnu.org/software/guile/manual/html_node/ Methods-and-Generic-Functions.html Marko -- https://mail.python.org/mailman/listinfo/python-list
Re: OT: This Swift thing
On Monday, June 9, 2014 9:50:38 AM UTC+5:30, Steven D'Aprano wrote: On Sun, 08 Jun 2014 19:24:52 -0700, Rustom Mody wrote: On Monday, June 9, 2014 7:14:24 AM UTC+5:30, Steven D'Aprano wrote: CPU technology is the triumph of brute force over finesse. If you are arguing that computers should not use millions/billions of transistors, I wont argue, since I dont know the technology. No. I'm arguing that they shouldn't convert 90% of their energy input into heat. Strange statement. What should they convert it into then? JFTR: Information processing and (physics) energy are about as convertible as say: Is a kilogram smaller/greater than a mile? -- https://mail.python.org/mailman/listinfo/python-list
Re: Uniform Function Call Syntax (UFCS)
On Monday, 9 June 2014 04:44:22 UTC+1, Chris Angelico wrote: This could be solved, though, by having a completely different symbol that means the thing on my left is actually the first positional parameter in the function call on my right, such as in your example: plus(1, 2) | divide(2) This would be absolutely identical to: divide(plus(1, 2), 2) Maybe you could even make it so that: plus(1, 2) x=| divide(y=2) is equivalent to divide(x=plus(1, 2), y=2) for the sake of consistency, and to allow the pipeline to inject something someplace other than the first argument. I'm not sure whether it'd be as useful in practice, though. It would depend partly on the exact syntax used. Obviously the pipe itself can't be used as it already means bitwise or, and this needs to be really REALLY clear about what's going on. But a data-flow notation would be of value in theory, at least. Perhaps a pipeline symbol plus an insertion marker would work better in Python: plus(1, 2) ~ divide(x=^, y=2) f.readlines() ~ map(int, ^) ~ min(^, key=lambda n: n % 10).str() ~ base64.b64encode(^, b'?-') ~ print(^) Stdio.read_file(foo.jpg) ~ Image.JPEG_decode(^).autocrop().rotate(0.5).grey() ~ Image.PNG_encode(^) ~ Stdio.write_file(foo.png, ^) -- https://mail.python.org/mailman/listinfo/python-list
Re: Uniform Function Call Syntax (UFCS)
On Mon, 09 Jun 2014 09:25:33 +0300, Marko Rauhamaa wrote: In a word, Python has predefined a handful of *generic functions/methods*, That's nine words :-) -- Steven D'Aprano http://import-that.dreamwidth.org/ -- https://mail.python.org/mailman/listinfo/python-list
Re: Uniform Function Call Syntax (UFCS)
On Mon, Jun 9, 2014 at 7:09 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Mon, 09 Jun 2014 09:25:33 +0300, Marko Rauhamaa wrote: In a word, Python has predefined a handful of *generic functions/methods*, That's nine words :-) I'll explain in two words: We propose to marry your daughters. http://math.boisestate.edu/gas/pirates/web_op/pirates13d.html ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: try/except/finally
On 2014-06-08, Dave Angel da...@davea.name wrote: Frank B fbick...@gmail.com Wrote in message: Ok; this is a bit esoteric. So finally is executed regardless of whether an exception occurs, so states the docs. But, I thought, if I return from my function first, that should take precedence. au contraire Turns out that if you do this: try: failingthing() except FailException: return 0 finally: return 1 Then finally really is executed regardless... even though you told it to return. That seems odd to me. The thing that's odd to me is that a return is permissible inside a finally block. That return should be at top level, even with the finally line. And of course something else should be in the body of the finally block. It does have some legitimate uses, for example: try: failingThing() finally: simple_cleanup() if(that_worked()) return complicated cleanup with lots of blocks OTOH, it could just be that Guido didn't think of banning it when exceptions were first added and doesn't want to introduce an incompatability later. -- https://mail.python.org/mailman/listinfo/python-list
Re: How to use SQLite (sqlite3) more efficiently
On 2014-06-06, Mark Lawrence breamore...@yahoo.co.uk wrote: On 06/06/2014 22:58, Dave Angel wrote: Chris Angelico ros...@gmail.com Wrote in message: On Sat, Jun 7, 2014 at 4:15 AM, R Johnson ps16thypresenceisfullnessof...@gmail.com wrote: The subject line isn't as important as a header, carried invisibly through, that says that you were replying to an existing post. :) Sorry for my ignorance, but I've never edited email headers before and didn't find any relevant help on Google. Could you please give some more details about how to do what you're referring to, or perhaps point me to a link that would explain more about it? (FYI, I read the Python mailing list on Google Groups, and reply to posts in Thunderbird, sending them to the Python-list email address.) The simple answer is: You don't have to edit headers at all. If you want something to be part of the same thread, you hit Reply and don't change the subject line. If you want something to be a spin-off thread, you hit Reply and *do* change the subject. If you want it to be a brand new thread, you don't hit Reply, you start a fresh message. Any decent mailer will do the work for you. Replying is more than just quoting a bunch of text and copying in the subject line with Re: at the beginning. :) set up a newsgroup in Thunderbird from gmane.comp.python.general. That doesn't sound right to me. Surely you set up the newgroup news.gmane.org and then subscribe to the mailing lists, blog feeds or whatever it is that you want? In usenet parlance, news.gmane.org is a newsserver, and gmane.comp.python.general is a newsgroup. gmane runs a series of mail-news gateways for several mailing lists, but there are others as well: someone also bridges the list to the group comp.lang.python, which is where I'm reading this. -- https://mail.python.org/mailman/listinfo/python-list
Re: OT: This Swift thing
On Sun, 08 Jun 2014 23:32:33 -0700, Rustom Mody wrote: On Monday, June 9, 2014 9:50:38 AM UTC+5:30, Steven D'Aprano wrote: On Sun, 08 Jun 2014 19:24:52 -0700, Rustom Mody wrote: On Monday, June 9, 2014 7:14:24 AM UTC+5:30, Steven D'Aprano wrote: CPU technology is the triumph of brute force over finesse. If you are arguing that computers should not use millions/billions of transistors, I wont argue, since I dont know the technology. No. I'm arguing that they shouldn't convert 90% of their energy input into heat. Strange statement. What should they convert it into then? Useful work, duh. Everything *eventually* gets converted to heat, but not immediately. There's a big difference between a car that gets 100 miles to the gallon, and one that gets 1 mile to the gallon. Likewise CPUs should get more processing units (however you measure them) per watt of electricity consumed. See, for example: http://www.tomshardware.com/reviews/fx-power-consumption-efficiency,3060.html http://en.wikipedia.org/wiki/Performance_per_watt Quote: Theoretically, room‑temperature computer memory operating at the Landauer limit could be changed at a rate of one billion bits per second with only 2.85 trillionths of a watt of power being expended in the memory media. Modern computers use millions of times as much energy. http://en.wikipedia.org/wiki/Landauer's_principle Much to my surprise, Wikipedia says that efficiency gains have actually been *faster* than Moore's Law. This surprises me, but it makes sense: if a CPU uses ten times more power to perform one hundred times more computations, it has become much more efficient but still needs a much bigger heat sink. http://en.wikipedia.org/wiki/Koomey's_law JFTR: Information processing and (physics) energy are about as convertible as say: Is a kilogram smaller/greater than a mile? (1) I'm not comparing incompatible units. And (2) there is a fundamental link between energy and entropy, and entropy is the reverse of information. See Landauer's Principle, linked above. So information processing and energy are as intimately linked as (say) current and voltage, or mass and energy, or momentum and position. -- Steven D'Aprano http://import-that.dreamwidth.org/ -- https://mail.python.org/mailman/listinfo/python-list
Re: Interfacing Fortran applications
On Mon, Jun 9, 2014 at 5:43 PM, Michael Welle mwe012...@gmx.net wrote: I want to build a Python based user interface for an existing Fortran application (as everyone wants to do ;)). Lets assume the application is parametrised via cmdline parameters and it calculates tons of numbers that have to find their way into the Python UI. There are several ways to achieve this: using stdin/stdout to exchange data, using files, converting the application to a library and load that from Python, etc. I thought about equipping the Fortran application with sockets, so that I can send input data and commands (which is now done via cmd line) and reading output data back. Any opinions on this? Best pratices? Is the application a complete black box? Sounds to me like you have the power to edit it, so I'm guessing you have the source code and some knowledge of how it works. If you can, as you suggest, convert it into a library that can be called from a C program, you can use Cython to call on it from Python. That'd be my first recommendation. (One-and-a-halfth recommendation: If the actual application is very simple, and most of its work is done in library functions, access the library via Cython, and port the main application logic entirely into Python. No need to wrap the application into a library, that way.) Second option would be some kind of coroutine system, interfacing via a socket. That's quite a good option; all you have to do is settle, between the two, a set of protocol rules. Some examples: * Everything is encoded in ASCII. (That gives you the option of expanding to UTF-8 later, if you need full Unicode, but keeps it really easy for now.) * Commands and responses are terminated with end-of-line, 0x0A. * Commands follow the basic shell style of command, then a space (0x20), then parameters. * If you don't need to overlay responses: One command's responses end with a dot (0x2E) on a blank line. (See SMTP for an example of this.) * If you do need to have multiple commands in flight simultaneously: Every command is prefixed with an arbitrary token, followed by a space, and every line of response is prefixed with the same token. (See IMAP for an example of this.) Nut out your protocol first, before you write a single line of code. Keep your protocol document up-to-date if you change anything. Then, if you want to write a different program for one end or the other, you can guarantee that they'll be able to communicate. And if you want to change from Unix sockets to TCP/IP sockets, or to stdin/stdout, or to any other system, the translation will be easier for having that document. Third option: Keep the application as it is, and use Python's subprocess module to send it parameters and maybe stdin, and retrieve its stdout. -- https://mail.python.org/mailman/listinfo/python-list
Re: try/except/finally
Philip Shaw jnufcvy...@tznvy.pbz: OTOH, it could just be that Guido didn't think of banning [return from finally] when exceptions were first added and doesn't want to introduce an incompatability later. You don't have to ban all nonsensical things. Most guns allow you to shoot yourself in the foot, even those with static type checking. Marko -- https://mail.python.org/mailman/listinfo/python-list
Re: Interfacing Fortran applications
Michael Welle mwe012...@gmx.net wrote: I thought about equipping the Fortran application with sockets, so that I can send input data and commands (which is now done via cmd line) and reading output data back. Any opinions on this? Best pratices? If you are to rewrite the Fortran app you can just as well use f2py from NumPy. Sturla -- https://mail.python.org/mailman/listinfo/python-list
Re: OT: This Swift thing
On Monday, June 9, 2014 2:57:26 PM UTC+5:30, Steven D'Aprano wrote: http://en.wikipedia.org/wiki/Landauer's_principle Hey thanks for that! Always thought something like this should exist but did not know what/where/how! On Sun, 08 Jun 2014 23:32:33 -0700, Rustom Mody wrote: On Monday, June 9, 2014 9:50:38 AM UTC+5:30, Steven D'Aprano wrote: On Sun, 08 Jun 2014 19:24:52 -0700, Rustom Mody wrote: On Monday, June 9, 2014 7:14:24 AM UTC+5:30, Steven D'Aprano wrote: CPU technology is the triumph of brute force over finesse. If you are arguing that computers should not use millions/billions of transistors, I wont argue, since I dont know the technology. No. I'm arguing that they shouldn't convert 90% of their energy input into heat. Strange statement. What should they convert it into then? Useful work, duh. Everything *eventually* gets converted to heat, but not immediately. There's a big difference between a car that gets 100 miles to the gallon, and one that gets 1 mile to the gallon. Likewise CPUs should get more processing units (however you measure them) per watt of electricity consumed. See, for example: http://www.tomshardware.com/reviews/fx-power-consumption-efficiency,3060.html http://en.wikipedia.org/wiki/Performance_per_watt Quote: Theoretically, room-temperature computer memory operating at the Landauer limit could be changed at a rate of one billion bits per second with only 2.85 trillionths of a watt of power being expended in the memory media. Modern computers use millions of times as much energy. Right so we are still very much in theoretical zone. As the next para there says: | If no information is erased, computation may in principle be achieved | which is thermodynamically reversible, and require no release of | heat. This has led to considerable interest in the study of reversible | computing. Particularly interesting as no-information-erasure corresponds to functional (or maybe relational) programming. Of course still all theoretical. Much to my surprise, Wikipedia says that efficiency gains have actually been *faster* than Moore's Law. This surprises me, but it makes sense: if a CPU uses ten times more power to perform one hundred times more computations, it has become much more efficient but still needs a much bigger heat sink. That was essentially my point -- https://mail.python.org/mailman/listinfo/python-list
ANN: eGenix pyOpenSSL Distribution 0.13.3.1.0.1.8
ANNOUNCING eGenix.com pyOpenSSL Distribution Version 0.13.3.1.0.1.8 An easy-to-install and easy-to-use distribution of the pyOpenSSL Python interface for OpenSSL - available for Windows, Mac OS X and Unix platforms This announcement is also available on our web-site for online reading: http://www.egenix.com/company/news/eGenix-pyOpenSSL-Distribution-0.13.3.1.0.1.8.html INTRODUCTION The eGenix.com pyOpenSSL Distribution includes everything you need to get started with SSL in Python. It comes with an easy-to-use installer that includes the most recent OpenSSL library versions in pre-compiled form, making your application independent of OS provided OpenSSL libraries: http://www.egenix.com/products/python/pyOpenSSL/ pyOpenSSL is an open-source Python add-on that allows writing SSL/TLS- aware network applications as well as certificate management tools: https://launchpad.net/pyopenssl/ OpenSSL is an open-source implementation of the SSL/TLS protocol: http://www.openssl.org/ NEWS This new release of the eGenix.com pyOpenSSL Distribution updates the included OpenSSL version to the latest OpenSSL 1.0.1h version and adds a few more context options: New in OpenSSL -- * Updated included OpenSSL libraries from OpenSSL to 1.0.1h. See http://www.openssl.org/news/secadv_20140605.txt for a complete list of changes, most important: - CVE-2014-0224: An attacker can force the use of weak keying material in OpenSSL SSL/TLS clients and servers. This can be exploited by a Man-in-the-middle (MITM) attack where the attacker can decrypt and modify traffic from the attacked client and server. - CVE-2014-0221: By sending an invalid DTLS handshake to an OpenSSL DTLS client the code can be made to recurse eventually crashing in a DoS attack. Only applications using OpenSSL as a DTLS client are affected. - CVE-2014-3470: OpenSSL TLS clients enabling anonymous ECDH ciphersuites are subject to a DoS attack. New in pyOpenSSL * Added the following new options for context.set_options(): OP_TLSEXT_PADDING, OP_SAFARI_ECDHE_ECDSA_BUG, OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION, OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION. * Documented all supported context.set_options() options (to the extent possible using the OpenSSL documentation itself). pyOpenSSL / OpenSSL Binaries Included - In addition to providing sources, we make binaries available that include both pyOpenSSL and the necessary OpenSSL libraries for all supported platforms: Windows x86 and x64, Linux x86 and x64, Mac OS X PPC, x86 and x64. We've also added egg-file distribution versions of our eGenix.com pyOpenSSL Distribution for Windows, Linux and Mac OS X to the available download options. These make setups using e.g. zc.buildout and other egg-file based installers a lot easier. DOWNLOADS The download archives and instructions for installing the package can be found at: http://www.egenix.com/products/python/pyOpenSSL/ UPGRADING Before installing this version of pyOpenSSL, please make sure that you uninstall any previously installed pyOpenSSL version. Otherwise, you could end up not using the included OpenSSL libs. ___ SUPPORT Commercial support for these packages is available from eGenix.com. Please see http://www.egenix.com/services/support/ for details about our support offerings. MORE INFORMATION For more information about the eGenix pyOpenSSL Distribution, licensing and download instructions, please visit our web-site or write to sa...@egenix.com. Enjoy, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Jun 09 2014) Python Projects, Consulting and Support ... http://www.egenix.com/ mxODBC.Zope/Plone.Database.Adapter ... http://zope.egenix.com/ mxODBC, mxDateTime, mxTextTools ...http://python.egenix.com/ 2014-05-28: Released mxODBC.Connect 2.1.0 ... http://egenix.com/go56 2014-07-02: Python Meeting Duesseldorf ... 23 days to go : Try our mxODBC.Connect Python Database Interface for free ! :: eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at
embedding ipython kernel in a thread
Hi, I'd like to embed an ipython kernel in an appliction, such, that I can use ipython console --existing kernel-pid.json lateron to connect to it and to look at some values Due to various reason I don not want to start it in the main thread. If you look at following example you will see, that I can start an ipython kernel and connect to it as long as I start it in the main thread. as soon as I start the kernel in another thread my ipython client prints the first few lines and a welcome text, but no prompt is shown. Does anybody know a way o how to start IPython outside of the main thread? Below code trying to show a working setup with ipython kernel in the main thread and failing if ipython kernel is started from another thread #!/usr/bin/env python import os, time, threading from IPython import embed_kernel cnt = { 'value' : 0 } def run_ip_kernel(): embed_kernel(local_ns={ 'cnt': cnt}) def example_thread(): while True: cnt['value'] += 1 print(cnt['value']) time.sleep(5) main_thread = run_ip_kernel other_thread = example_thread # if I uncomment the next two lines, then I can no more # execute my interactive IPython shell #main_thread = example_thread #other_thread = run_ip_kernel print(now you can try to connect to this shell with:) print(ipython console --existing kernel-%d.json % os.getpid()) threading.Thread(target=other_thread).start() main_thread() -- https://mail.python.org/mailman/listinfo/python-list
Re: OT: This Swift thing
In article 53953616$0$29988$c3e8da3$54964...@news.astraweb.com, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: Moore's Law observes that processing power has doubled about every two years. Over the last decade, processing power has increased by a factor of 32. If *efficiency* had increased at the same rate, that 500W power supply in your PC would now be a 15W power supply. I think you're using a strange definition of efficiency. I would define it as electric_power_in / processing_power_out. If processing power has gone up by a factor of 32, and electric power used has stayed more or less the same (which it has), then efficiency has gone up. Your mobile phone would last a month between recharges, not a day. Your laptop could use a battery half the size and still last two weeks on a full charge. One of the real industrial problems facing today's society is storage of electrical energy in batteries. The lead-acid batteries in our cars are not terribly different from the ones in our grandparents' cars (or even our great-grandparents', if they had cars). The storage capacity has gone up a little, mostly because the plastic shells we use now are thinner than the bakelite shells they used to use, so there's more internal volume for the same external size container. And, yes, we now have other chemistries (lithium ion, metal hydride, etc) which are better in various ways, but the energy density (joules / kg) really hasn't changed much in 100 years. No. I'm arguing that they shouldn't convert 90% of their energy input into heat. Actually, they convert 100% of their energy input into heat. The trick is having them do something useful along the way. -- https://mail.python.org/mailman/listinfo/python-list
Re: embedding ipython kernel in a thread
On 06/09/2014 01:59 PM, Gelonida N wrote: Hi, I'd like to embed an ipython kernel in an appliction, such, that I can use ipython console --existing kernel-pid.json lateron to connect to it and to look at some values Due to various reason I don not want to start it in the main thread. If you look at following example you will see, that I can start an ipython kernel and connect to it as long as I start it in the main thread. as soon as I start the kernel in another thread my ipython client prints the first few lines and a welcome text, but no prompt is shown. Does anybody know a way o how to start IPython outside of the main thread? Below code trying to show a working setup with ipython kernel in the main thread and failing if ipython kernel is started from another thread #!/usr/bin/env python import os, time, threading from IPython import embed_kernel cnt = { 'value' : 0 } def run_ip_kernel(): embed_kernel(local_ns={ 'cnt': cnt}) def example_thread(): while True: cnt['value'] += 1 print(cnt['value']) time.sleep(5) main_thread = run_ip_kernel other_thread = example_thread # if I uncomment the next two lines, then I can no more # execute my interactive IPython shell #main_thread = example_thread #other_thread = run_ip_kernel print(now you can try to connect to this shell with:) print(ipython console --existing kernel-%d.json % os.getpid()) threading.Thread(target=other_thread).start() main_thread() Whatever you're trying to do(...) ... if you look at the script I provide you in attach and if you can think how usefull it would be to control exponencially what you need ... that's certainly one best approach ... https://www.youtube.com/watch?v=p7CaiWxKYBo Regards, Carlos $id_flux[idsponsor]=2; // $flux_treat=array(397,382,769,770); //$flux_treat=array(397,382); $flux_treat=array(521,6876); $textemailmessage=; include(../../conf.inc.php); if(is_array($flux_treat)){ foreach($flux_treat as $kfluxtotreat = $vfluxtotreat){ //echo $kfluxtreatsubtype.br; if(!empty($array_language_flux_default[$vfluxtotreat])){ $id_language_default=$array_language_flux_default[$vfluxtotreat]; } $info_page_records=explode(|,$array_number_records_per_page_start_flux[$vfluxtotreat]); if(is_array($id_flux[detail][$vfluxtotreat])){ foreach($id_flux[detail][$vfluxtotreat][Sponsor][url][information][xml] as $kfluxtreatsubtype=$vfluxtreatsubtype){ //control if execution is allowed by kfluxtreatsubtype and add exit echo $kfluxtreatsubtype.br; if(check_lock_control_($kfluxtreatsubtype,start)==ok){ $_ids_types_xml_cache_=$_ids_types_xml_[$kfluxtreatsubtype]; $_time_of_cache_flux_subtype=$_ids_types_xml_time_cache_[$kfluxtreatsubtype]; //echo time of cache .$_time_of_cache_flux_subtype.br; if($kfluxtreatsubtype ==xml-movies){ $number_records_or_end_position=$info_page_records[0]; $counterfilter=0; foreach($id_flux[detail][$vfluxtotreat][languages] as $klg = $vlg){ foreach($ids_cats_sponsor[$vfluxtotreat] as $kcat = $vcat){ $cat_convereted_cache=$vcat; $pagenumb=$limitepaginas=$info_page_records[1]; while ($pagenumb=$limitepaginas){ $replacements=array($id_flux[idsponsorfk],$id_flux[loginsponsor],$id_flux[passwordsponsor],$kcat,{idcatsonsponsor},$pagenumb,$vlg,$number_records_or_end_position,{filter},$_SERVER['REMOTE_ADDR'],$id_flux[keysponsor],{tracker},{iditemdetail},{idsubitemdetail},{subtracker}); $urlstringtreat =str_replace($patterns, $replacements, $vfluxtreatsubtype); $page_number_cache=$pagenumb;
Re: Uniform Function Call Syntax (UFCS)
On Mon, 09 Jun 2014 19:13:40 +1000, Chris Angelico wrote: On Mon, Jun 9, 2014 at 7:09 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Mon, 09 Jun 2014 09:25:33 +0300, Marko Rauhamaa wrote: In a word, Python has predefined a handful of *generic functions/methods*, That's nine words :-) I'll explain in two words: We propose to marry your daughters. http://math.boisestate.edu/gas/pirates/web_op/pirates13d.html In what language does often (\ˈȯ-fən, ÷ˈȯf-tən\) sound like orphan (\ˈȯr-fən\)? ('oh-fan', 'ov-ten' or even 'off-ten' versus 'or-fen') No wonder Gilbert and Sullivan had difficulty seeking success after HMS Pinafore... http://www.youtube.com/watch?v=0Y27MfF-n_Y -- Steven D'Aprano http://import-that.dreamwidth.org/ -- https://mail.python.org/mailman/listinfo/python-list
Re: OT: This Swift thing
On Monday 09 June 2014 02:32:33 Rustom Mody did opine And Gene did reply: On Monday, June 9, 2014 9:50:38 AM UTC+5:30, Steven D'Aprano wrote: On Sun, 08 Jun 2014 19:24:52 -0700, Rustom Mody wrote: On Monday, June 9, 2014 7:14:24 AM UTC+5:30, Steven D'Aprano wrote: CPU technology is the triumph of brute force over finesse. If you are arguing that computers should not use millions/billions of transistors, I wont argue, since I dont know the technology. No. I'm arguing that they shouldn't convert 90% of their energy input into heat. Looking at the whole system, about the only energy input that is not converted to heat, would be the milliwatt or 3 of sound from the speaker when it beeps at you, and the additional energy to spin the fans. That is all calculate able if you have experience in air moving, as in HVAC. Strange statement. What should they convert it into then? JFTR: Information processing and (physics) energy are about as convertible as say: Is a kilogram smaller/greater than a mile? ;-) Cheers, Gene Heskett -- There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order. -Ed Howdershelt (Author) Genes Web page http://geneslinuxbox.net:6309/gene US V Castleman, SCOTUS, Mar 2014 is grounds for Impeaching SCOTUS -- https://mail.python.org/mailman/listinfo/python-list
Re: OT: This Swift thing
On 06/08/2014 10:20 PM, Steven D'Aprano wrote: A typical desktop computer uses less than 500 watts for *everything* except the screen. Hard drives. DVD burner. Keyboard, mouse, USB devices, network card, sound card, graphics card, etc. (Actually, 350W is more typical.) Moore's Law observes that processing power has doubled about every two years. Over the last decade, processing power has increased by a factor of 32. If *efficiency* had increased at the same rate, that 500W power supply in your PC would now be a 15W power supply. Your mobile phone would last a month between recharges, not a day. Your laptop could use a battery half the size and still last two weeks on a full charge. Actually that's not what Moore's law is about. Moore's law states that the number of transistors on the die doubles every 18 months. Any other doubling of something else is entirely coincidental. snip No. I'm arguing that they shouldn't convert 90% of their energy input into heat. All electronic circuits that don't create a motive force that performs work convert 100% of their electrical energy into heat. I'm using work defined in the physics sense. CPUs take in electricity and expire 100% of it as heat, and do so immediately. This conversion to heat does happen to do something useful along the way (flipping states on transistors that represent information). We used to tell people that computers make very efficient space heaters. Because in fact they do. -- https://mail.python.org/mailman/listinfo/python-list
Re: OT: This Swift thing
Gene Heskett ghesk...@wdtv.com: Looking at the whole system, about the only energy input that is not converted to heat, would be the milliwatt or 3 of sound from the speaker when it beeps at you, and the additional energy to spin the fans. That all becomes heat as well. The dust particles that stick to the ceiling would be an example of energy not wasted as heat (gravitational potential energy). Marko -- https://mail.python.org/mailman/listinfo/python-list
Re: Uniform Function Call Syntax (UFCS)
On Jun 8, 2014 9:56 PM, Steven D'Aprano which means that hasattr (which is defined by attempting to get the attribute and seeing if an exception is thrown) has to return True. Yes. And this is a problem why? Earlier in this thread I pointed out that returning True creates problems for duck typing. But I'm now convinced that's preferable to making getattr and hasattr inconsistent. -- https://mail.python.org/mailman/listinfo/python-list
Re: OT: This Swift thing
Michael Torrie torr...@gmail.com: We used to tell people that computers make very efficient space heaters. Because in fact they do. And that's no joke. Our home in Finland is heated with electric radiators. They are on 8-9 months a year. During those months, the use of all electrical appliances is free (apart from wear and tear). Marko -- https://mail.python.org/mailman/listinfo/python-list
Re: embedding ipython kernel in a thread
On 6/9/2014 3:34 PM, Carlos Anselmo Dias wrote: On 06/09/2014 01:59 PM, Gelonida N wrote: Hi, I'd like to embed an ipython kernel in an appliction, such, that I can use ipython console --existing kernel-pid.json lateron to connect to it and to look at some values Due to various reason I don not want to start it in the main thread. If you look at following example you will see, that I can start an ipython kernel and connect to it as long as I start it in the main thread. as soon as I start the kernel in another thread my ipython client prints the first few lines and a welcome text, but no prompt is shown. Does anybody know a way o how to start IPython outside of the main thread? Below code trying to show a working setup with ipython kernel in the main thread and failing if ipython kernel is started from another thread #!/usr/bin/env python import os, time, threading from IPython import embed_kernel cnt = { 'value' : 0 } def run_ip_kernel(): embed_kernel(local_ns={ 'cnt': cnt}) def example_thread(): while True: cnt['value'] += 1 print(cnt['value']) time.sleep(5) main_thread = run_ip_kernel other_thread = example_thread # if I uncomment the next two lines, then I can no more # execute my interactive IPython shell #main_thread = example_thread #other_thread = run_ip_kernel print(now you can try to connect to this shell with:) print(ipython console --existing kernel-%d.json % os.getpid()) threading.Thread(target=other_thread).start() main_thread() Whatever you're trying to do(...) ... if you look at the script I provide you in attach and if you can think how usefull it would be to control exponencially what you need ... that's certainly one best approach ... Not sure what you are trying to tell me with attached PHP code. I hope my script is understandable to those who embedded IPython into their own python application. Some details, that I forgot to mention: I'm using IPython 2.0 (the API is different to the predecessor versions) and I based my code on the examples shown on the IPython web site. However the example code doesn't seem to work in any other thread than the main thread. Related link: http://ipython.org/ipython-doc/2/interactive/reference.html#embedding thanks again for any help. I'm rather curious to learn why the embedded kernel seems to block and top find a way to circumvent this behavoiur. -- https://mail.python.org/mailman/listinfo/python-list
Re: Interfacing Fortran applications
On Mon, Jun 9, 2014 at 10:24 PM, Michael Welle mwe012...@gmx.net wrote: I can change everything until after the initialisation of the application and the output of the results. That, hopefully, will not break something. Okay. So you should be able to go for the socket approach, fairly easily. Or possibly you could turn the whole thing into a C-callable library, although I've no idea how easy it is to do that. (My experience with FORTRAN - yes, not Fortran, the code was that old - goes as far as eyeballing some of IBM's DB2 examples and translating them into REXX. I've never actually used a Fortran compiler.) ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: embedding ipython kernel in a thread
On 06/09/2014 03:55 PM, Gelonida N wrote: Not sure what you are trying to tell me with attached PHP code. Hi ... Nothing important I'd write for what you're seeking ... I'm not one Python expert ... just reading fast what you wrote ... it's certainly one interesting issue if you can control that looking at n machines (...) ... depending on the scope and 'return back' to execute what should be executed I'd write ... Instead of looking to one single machine look at n machines(...) Regards, Carlos -- https://mail.python.org/mailman/listinfo/python-list
None in string = TypeError?
We noticed recently that: None in 'foo' raises (at least in Python 2.7) TypeError: 'in string' requires string as left operand, not NoneType This is surprising. The description of the 'in' operatator is, 'True if an item of s is equal to x, else False '. From that, I would assume it behaves as if it were written: for item in iterable: if item == x: return True else: return False why the extra type check for str.__contains__()? That seems very unpythonic. Duck typing, and all that. -- https://mail.python.org/mailman/listinfo/python-list
Re: embedding ipython kernel in a thread
On 06/09/2014 04:07 PM, Carlos Anselmo Dias wrote: On 06/09/2014 03:55 PM, Gelonida N wrote: Not sure what you are trying to tell me with attached PHP code. Hi ... Nothing important I'd write for what you're seeking ... I'm not one Python expert ... just reading fast what you wrote ... it's certainly one interesting issue if you can control that looking at n machines (...) ... depending on the scope and 'return back' to execute what should be executed I'd write ... Instead of looking to one single machine look at n machines(...) Regards, Carlos Let me add this to finish ... If you think about your example and you consider that it could be used for example in one sort of cache management with remote subtlety ... or whatever ... If the system was hashed(...) ... and you need to delete dependencies(...) ... if the dependencies were in different machines considering that one dependency can be as simple as one serialized/compressed file with information ... Than without thinking too much what you're doing could be used to do something like that ... and exponentially ... you'd control n machines ... and all the dependencies ... I don't know if you understand me ... english is not my maternal language ... I'm not adding more comments to this issue ... Best regards, Carlos -- https://mail.python.org/mailman/listinfo/python-list
Re: None in string = TypeError?
On Mon, Jun 9, 2014 at 10:34 AM, Roy Smith r...@panix.com wrote: We noticed recently that: None in 'foo' raises (at least in Python 2.7) TypeError: 'in string' requires string as left operand, not NoneType This is surprising. It's the same in 3.4, and I agree that it's surprising, at least to me . I don't know the story or implementation behind it, so I'll leave that to others. -- https://mail.python.org/mailman/listinfo/python-list
Suds 4.1 Beta Assertion Failure
Hello group, I have been using Python suds to try to consume a web service. I am able to use tools like SOAPUI and it works but when I it in python I get Assertion Failure. Here is my code if __name__== '__main__': from suds.client import Client import logging logging.basicConfig(filename=suds.log,level=logging.INFO) logging.getLogger('suds.wsdl').setLevel(logging.DEBUG) obieeserver='http://hostname:port/analytics-ws/saw.dll/wsdl/v7' rptRef='myReport' paramRpt='' client = Client(obieeserver) sessionid = client.service['SAWSessionService'].logon('uid','pwd') print 'sessionid=',sessionid reportservice=client.service['ReportEditingService'] result=reportservice.generateReportSQL(rptRef, paramRpt, sessionid) print 'result=',type(result) Here is my output: sessionid= fq3c0f0ec7hrql07fspk7fdu4esih16pp4eql9a Traceback (most recent call last): File obieetest.py, line 90, in module result=reportservice.generateReportSQL(rptRef, paramRpt, sessionid) File build\bdist.win32\egg\suds\client.py, line 542, in __call__ File build\bdist.win32\egg\suds\client.py, line 602, in invoke File build\bdist.win32\egg\suds\client.py, line 651, in send File build\bdist.win32\egg\suds\client.py, line 688, in succeeded File build\bdist.win32\egg\suds\bindings\binding.py, line 151, in get_reply File build\bdist.win32\egg\suds\bindings\binding.py, line 182, in detect_fault suds.WebFault: Server raised fault: 'Assertion failure: criteria at line 296 of /net/adcnas420/export/ifarm_base/ifarm_views/aime_bifndn_430300/bifndn/analytics_web/main/project/webformatengine/formatengine.cpp' -- https://mail.python.org/mailman/listinfo/python-list
Re: None in string = TypeError?
On Mon, Jun 9, 2014 at 9:34 AM, Roy Smith r...@panix.com wrote: We noticed recently that: None in 'foo' raises (at least in Python 2.7) TypeError: 'in string' requires string as left operand, not NoneType This is surprising. The description of the 'in' operatator is, 'True if an item of s is equal to x, else False '. From that, I would assume it behaves as if it were written: for item in iterable: if item == x: return True else: return False why the extra type check for str.__contains__()? That seems very unpythonic. Duck typing, and all that. I guess for the same reason that you get a TypeError if you test whether the number 4 is in a string: it can't ever be, so it's a nonsensical comparison. It could return False, but the comparison is more likely to be symptomatic of a bug in the code than intentional, so it makes some noise instead. -- https://mail.python.org/mailman/listinfo/python-list
Re: None in string = TypeError?
Hello, On Mon, 9 Jun 2014 08:34:42 -0700 (PDT) Roy Smith r...@panix.com wrote: We noticed recently that: None in 'foo' raises (at least in Python 2.7) TypeError: 'in string' requires string as left operand, not NoneType This is surprising. The description of the 'in' operatator is, 'True if an item of s is equal to x, else False '. From that, I would assume it behaves as if it were written: for item in iterable: if item == x: return True else: return False why the extra type check for str.__contains__()? That seems very unpythonic. Duck typing, and all that. -- This is very Pythonic, Python is strictly typed language. There's no way None could possibly be inside a string, so if you're trying to look for it there, you're doing something wrong, and told so. Also, it's not extra check, it's extra checks less, just consider that in operator just checks types of its arguments for sanity once at the start, and then just looks for a substring within string. You suggest that it should check for each element type in a loop, which is great waste, as once again, nothing but a string can be inside another string. -- Best regards, Paul mailto:pmis...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list
Re: None in string = TypeError?
On 2014-06-09 16:34, Roy Smith wrote: We noticed recently that: None in 'foo' raises (at least in Python 2.7) TypeError: 'in string' requires string as left operand, not NoneType This is surprising. The description of the 'in' operatator is, 'True if an item of s is equal to x, else False '. From that, I would assume it behaves as if it were written: for item in iterable: if item == x: return True else: return False why the extra type check for str.__contains__()? That seems very unpythonic. Duck typing, and all that. When working with strings, it's not entirely the same. For example: 'oo' in 'foo' True If you iterated over the string, it would return False. -- https://mail.python.org/mailman/listinfo/python-list
Re: None in string = TypeError?
On Mon, 09 Jun 2014 08:34:42 -0700, Roy Smith wrote: We noticed recently that: None in 'foo' raises (at least in Python 2.7) That goes back to at least Python 1.5, when member tests only accepted a single character, not a substring: None in abc Traceback (innermost last): File stdin, line 1, in ? TypeError: string member test needs char left operand It's a matter of taste whether predicate functions should always return a bool, or sometimes raise an exception. Would you be surprised that this raises TypeError? my string.startswith(None) A predicate function could swallow any exception, e.g. be the logical equivalent of: try: return True if the condition holds, else return False except: return False # or True as needed but that is, I think, an anti-pattern, as it tends to hide errors rather than be useful. Most of the time, doing `[] in xyz` is an error, so returning False is not a useful thing to do. I think that Python has been moving away from the swallow exceptions model in favour of letting errors propagate. E.g. hasattr used to swallow a lot more exceptions than it does now, and order comparisons (less than, greater than etc.) of dissimilar types used to return a version-dependent arbitrary but consistent result (e.g. all ints compared less than all strings), but in Python 3 that is now an error. -- Steven D'Aprano http://import-that.dreamwidth.org/ -- https://mail.python.org/mailman/listinfo/python-list
Re: None in string = TypeError?
2014-06-09 23:34 GMT+08:00 Roy Smith r...@panix.com: We noticed recently that: None in 'foo' raises (at least in Python 2.7) TypeError: 'in string' requires string as left operand, not NoneType This is surprising. The description of the 'in' operatator is, 'True if an item of s is equal to x, else False '. From that, I would assume it behaves as if it were written: for item in iterable: if item == x: return True else: return False why the extra type check for str.__contains__()? That seems very unpythonic. Duck typing, and all that. It's a little bit inconsistent. But it's clearly documented here: https://docs.python.org/3/reference/expressions.html#in Which, according to its own logic, the string is not a *container* type. It's just some chars, and that totally makes sense for to restrict the type of x in str to be convertible to type str. On the other hand, containers like list, and tuple, they are heterogeneous by default in Python, so a item by item comparison is needed. -- 吾輩は猫である。ホームーページはhttp://introo.me。 -- https://mail.python.org/mailman/listinfo/python-list
Re: None in string = TypeError?
On Mon, 09 Jun 2014 18:57:28 +0300, Paul Sokolovsky wrote: Hello, On Mon, 9 Jun 2014 08:34:42 -0700 (PDT) Roy Smith r...@panix.com wrote: We noticed recently that: None in 'foo' raises (at least in Python 2.7) TypeError: 'in string' requires string as left operand, not NoneType This is surprising. The description of the 'in' operatator is, 'True if an item of s is equal to x, else False'. From that, I would assume it behaves as if it were written: for item in iterable: if item == x: return True else: return False why the extra type check for str.__contains__()? That seems very unpythonic. Duck typing, and all that. -- This is very Pythonic, Python is strictly typed language. There's no way None could possibly be inside a string, Then `None in some_string` could immediately return False, instead of raising an exception. so if you're trying to look for it there, you're doing something wrong, and told so. This, I think, is the important factor. `x in somestring` is almost always an error if x is not a string. If you want to accept None as well: x is not None and x in somestring does the job nicely. -- Steven D'Aprano http://import-that.dreamwidth.org/ -- https://mail.python.org/mailman/listinfo/python-list
Re: try/except/finally
It would be great if someone could discuss it from the viewpoint of bytecode. e.g., how the stack is popped, etc. 2014-06-09 17:40 GMT+08:00 Marko Rauhamaa ma...@pacujo.net: Philip Shaw jnufcvy...@tznvy.pbz: OTOH, it could just be that Guido didn't think of banning [return from finally] when exceptions were first added and doesn't want to introduce an incompatability later. You don't have to ban all nonsensical things. Most guns allow you to shoot yourself in the foot, even those with static type checking. Marko -- https://mail.python.org/mailman/listinfo/python-list -- 吾輩は猫である。ホームーページはhttp://introo.me。 -- https://mail.python.org/mailman/listinfo/python-list
Re: None in string = TypeError?
On Tue, Jun 10, 2014 at 2:14 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: This is very Pythonic, Python is strictly typed language. There's no way None could possibly be inside a string, Then `None in some_string` could immediately return False, instead of raising an exception. Note, by the way, that CPython does have some optimizations that immediately return False. If you ask if a 16-bit string is in an 8-bit string, eg \u1234 in asdf, it knows instantly that it cannot possibly be, and it just returns false. The None in string check is different, and deliberately so. I do prefer the thrown error. Some things make absolutely no sense, and even if it's technically valid to say No, the integer 61 is not in the string 'asdf', it's likely to be helpful to someone who thinks that characters and integers are equivalent. You'll get an exception immediately, instead of trying to figure out why it's returning False. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: None in string = TypeError?
On Jun 9, 2014, at 11:57 AM, Paul Sokolovsky wrote: This is very Pythonic, Python is strictly typed language. There's no way None could possibly be inside a string, so if you're trying to look for it there, you're doing something wrong, and told so. Well, the code we've got is: hourly_data = [(t if status in 'CSRP' else None) for (t, status) in hours] where status can be None. I don't think I'm doing anything wrong. I wrote exactly what I mean :-) We've changed it to: hourly_data = [(t if (status and status in 'CSRP') else None) for (t, status) in hours] but that's pretty ugly. In retrospect, I suspect: hourly_data = [(t if status in set('CSRP') else None) for (t, status) in hours] is a little cleaner. --- Roy Smith r...@panix.com -- https://mail.python.org/mailman/listinfo/python-list
Re: try/except/finally
On Mon, Jun 9, 2014 at 11:23 AM, Shiyao Ma i...@introo.me wrote: It would be great if someone could discuss it from the viewpoint of bytecode. e.g., how the stack is popped, etc. BITD, you couldn't have try/except/finally. You could have try/except or try/finally. You could nest the two, which is what people used to do (back when we had to walk uphill both ways to school in a snowstorm). As I recall, it wasn't implemented from the start because the benefit of having try/except/finally didn't outweigh the difficulty of implementation. Someone finally buckled down and implemented it. To understand it, I think you might have to read the source and PEP 341. -- https://mail.python.org/mailman/listinfo/python-list
Re: None in string = TypeError?
On Tue, Jun 10, 2014 at 2:53 AM, Roy Smith r...@panix.com wrote: In retrospect, I suspect: hourly_data = [(t if status in set('CSRP') else None) for (t, status) in hours] is a little cleaner. I'd go with this. It's clearer that a status of 'SR' should result in False, not True. (Presumably that can never happen, but it's easier to read.) I'd be inclined to use set literal syntax, even though it's a bit longer - again to make it clear that these are four separate strings that you're checking against. Alternatively, you could go if status or '0' in 'CSRP, which would work, but be quite cryptic. (It would also mean that '' is not deemed to be in the string, same as the set() transformation does.) ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: None in string = TypeError?
On Mon, Jun 9, 2014 at 10:59 AM, Chris Angelico ros...@gmail.com wrote: On Tue, Jun 10, 2014 at 2:53 AM, Roy Smith r...@panix.com wrote: In retrospect, I suspect: hourly_data = [(t if status in set('CSRP') else None) for (t, status) in hours] is a little cleaner. I'd go with this. It's clearer that a status of 'SR' should result in False, not True. (Presumably that can never happen, but it's easier to read.) I'd be inclined to use set literal syntax, even though it's a bit longer - again to make it clear that these are four separate strings that you're checking against. Depending on how much work this has to do, I might also consider moving the set construction outside the list comprehension since it doesn't need to be repeated on every iteration. -- https://mail.python.org/mailman/listinfo/python-list
Re: None in string = TypeError?
On Tue, Jun 10, 2014 at 3:22 AM, Ian Kelly ian.g.ke...@gmail.com wrote: On Mon, Jun 9, 2014 at 10:59 AM, Chris Angelico ros...@gmail.com wrote: On Tue, Jun 10, 2014 at 2:53 AM, Roy Smith r...@panix.com wrote: In retrospect, I suspect: hourly_data = [(t if status in set('CSRP') else None) for (t, status) in hours] is a little cleaner. I'd go with this. It's clearer that a status of 'SR' should result in False, not True. (Presumably that can never happen, but it's easier to read.) I'd be inclined to use set literal syntax, even though it's a bit longer - again to make it clear that these are four separate strings that you're checking against. Depending on how much work this has to do, I might also consider moving the set construction outside the list comprehension since it doesn't need to be repeated on every iteration. Set literal notation will accomplish that, too, for what it's worth. def x(): hourly_data = [(t if status in {'C','S','R','P'} else None) for (t, status) in hours] dis.dis(x) 2 0 LOAD_CONST 1 (code object listcomp at 0x012BE660, file pyshell#10, line 2) 3 LOAD_CONST 2 ('x.locals.listcomp') 6 MAKE_FUNCTION0 9 LOAD_GLOBAL 0 (hours) 12 GET_ITER 13 CALL_FUNCTION1 (1 positional, 0 keyword pair) 16 STORE_FAST 0 (hourly_data) 19 LOAD_CONST 0 (None) 22 RETURN_VALUE dis.dis(x.__code__.co_consts[1]) 2 0 BUILD_LIST 0 3 LOAD_FAST0 (.0) 6 FOR_ITER36 (to 45) 9 UNPACK_SEQUENCE 2 12 STORE_FAST 1 (t) 15 STORE_FAST 2 (status) 18 LOAD_FAST2 (status) 21 LOAD_CONST 5 (frozenset({'R', 'S', 'C', 'P'})) 24 COMPARE_OP 6 (in) 27 POP_JUMP_IF_FALSE 36 30 LOAD_FAST1 (t) 33 JUMP_FORWARD 3 (to 39) 36 LOAD_CONST 4 (None) 39 LIST_APPEND 2 42 JUMP_ABSOLUTE6 45 RETURN_VALUE isinstance(x.__code__.co_consts[1].co_consts[5],set) False Interestingly, the literal appears to be a frozenset rather than a regular set. The compiler must have figured out that it can never be changed, and optimized. Also, this is the first time I've seen None as a constant other than the first. Usually co_consts[0] is None, but this time co_consts[4] is None. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: None in string = TypeError?
On Mon, Jun 9, 2014 at 11:40 AM, Chris Angelico ros...@gmail.com wrote: Also, this is the first time I've seen None as a constant other than the first. Usually co_consts[0] is None, but this time co_consts[4] is None. Functions always seem to have None as the first constant, but modules and classes are other examples that don't. co = compile(class MyClass: pass, '', 'exec') co.co_consts (code object MyClass at 0x7f32aa0a3c00, file , line 1, 'MyClass', None) co.co_consts[0].co_consts ('MyClass', None) -- https://mail.python.org/mailman/listinfo/python-list
Re: None in string = TypeError?
On Tue, Jun 10, 2014 at 3:58 AM, Ian Kelly ian.g.ke...@gmail.com wrote: On Mon, Jun 9, 2014 at 11:40 AM, Chris Angelico ros...@gmail.com wrote: Also, this is the first time I've seen None as a constant other than the first. Usually co_consts[0] is None, but this time co_consts[4] is None. Functions always seem to have None as the first constant, but modules and classes are other examples that don't. co = compile(class MyClass: pass, '', 'exec') co.co_consts (code object MyClass at 0x7f32aa0a3c00, file , line 1, 'MyClass', None) co.co_consts[0].co_consts ('MyClass', None) Huh. Learn something every day! ChrisA -- https://mail.python.org/mailman/listinfo/python-list
lists vs. NumPy arrays for sets of dates and strings
I am going to read a multivariate time series from a CSV file that looks like Date,A,B 2014-01-01,10.0,20.0 2014-01-02,10.1,19.9 ... The numerical data I will store in a NumPy array, since they are more convenient to work with than lists of lists. What are the advantages and disadvantages of storing the symbols [A,B] and dates [2014-01-01,2014-01-02] as lists vs. NumPy arrays? -- https://mail.python.org/mailman/listinfo/python-list
First time I looked at Python was(...)
Hi ... I'm finishing my messages with this ... The first time I looked into Python was +- 10 years ago ... and in the last 10 years I did not spent more than 30 minutes looking at ... but I like it ... it's easy to read ... even if I'm not familiar with the syntax of ... When you look at the script I provided you in my first post ... if you're capable of thinking about it ... yoy can see countless terabytes/petabytes of information indexed .. it doesn't matter what you're daling with ...it might be millions of databases or billions of files ... I spent the last two days thinking about what I want to implement(...) ... looking at your posts ... thinking in the wideness and in the particularity of the detail ... I really consider that Python is one good option(probably the best) ... the programmers need less lines of code to achieve what must be achieved ... and this is one great advantage ... If you read what I wrote in my first post -'Python team(...)' and if somehow you're capable of visualize that integrated with logs ,etc ... advertisement included, manipulation of the search string in the client apis, etc ... you're very probably very capable of ... (...) Best regards, Carlos -- https://mail.python.org/mailman/listinfo/python-list
Re: lists vs. NumPy arrays for sets of dates and strings
On Mon, 09 Jun 2014 12:48:12 -0700, beliavsky wrote: I am going to read a multivariate time series from a CSV file that looks like Date,A,B 2014-01-01,10.0,20.0 2014-01-02,10.1,19.9 ... The numerical data I will store in a NumPy array, since they are more convenient to work with than lists of lists. What are the advantages and disadvantages of storing the symbols [A,B] and dates [2014-01-01,2014-01-02] as lists vs. NumPy arrays? You could also use a dictionary of either lists or tuples or even NumPy arrays keyed on the date. $ python Python 2.7.3 (default, Feb 27 2014, 19:58:35) [GCC 4.6.3] on linux2 Type help, copyright, credits or license for more information. import numpy x = {} y = numpy.array( [0,1] ) x['2014-06-05'] = y x['2014-06-05'] array([0, 1]) x {'2014-06-05': array([0, 1])} x['2014-06-05'][0] 0 x['2014-06-05'][1] 1 -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list
Re: Interfacing Fortran applications
On 09/06/14 14:24, Michael Welle wrote: If you are to rewrite the Fortran app you can just as well use f2py from NumPy. a rewrite of the application isn't possible. That would require knowledge about what the used algorithms are, why they are implemented as they are, that would require extensive testing with test cases that don't exist. You are ok with adding sockets and IPC to a Fortran app, but using f2py is off limits because it requires a rewrite? Sorry, this doesn't make any sense. But it's your problem, I don't care what you decide to do. Sturla -- https://mail.python.org/mailman/listinfo/python-list
Re: Is MVC Design Pattern good enough?
The most intuitive approach to database applications would be: http://en.wikipedia.org/wiki/Naked_objects http://www.nakedobjects.org/ [...] Unfortunately, there's no Python framework (yet?) that implements this design. It could be a blessing in disguise. Too often people encumber simple concepts with frameworks. The point is that frameworks (for this kind of application) (should) allow people who are not computer scientists but domain specialists to implement useful applications. Which makes sense since especially in the domain of typical business applications, since it's much easier to teach a reasonably computer-literate domain specialist a programming language that's user-friendly such as Python and a user-friendly framework, instead of teaching a software developer the knowledge of the application domain. So the computer scientist(s) designs and implement the framework, and the domain specialist(s) implements the domain-specific application logic. The naked objects concept makes this especially intuitive since all the domain-specific application logic is in the business objects. And since you don't need to implement anything else besides these to get a functional application. Unfortunately, the developer of the naked objects framework has chosen a language that is pretty bad in terms of usability for domain specialists; Java. And it sucks for GUIs, too. C# isn't much better, expecially since it's limited to a pathologic non-operating system. Python could demonstrate the interest of this concept much better than the existing Java and C# implementations, not only because it's much better suited to non-computer scientists, but also because it's more cross-platform than C# and better for GUIs than Java. Another important aspect of naked objects is about reducing the amount of code that needs to get written to implement a given functionality. Python is definitely more efficient here than Java and C#. In short; Python would be the perfect choice of implementation language for such a (naked objects) framework. Unfortunately with all that hype about web applications, there is little focus today on (frameworks for) applications that are actually useful for end-users who have to get real work done with the computer. Sincerely, Wolfgang -- https://mail.python.org/mailman/listinfo/python-list
Re: os.startfile hanging onto the launched app, or my IDE?
On Saturday, June 7, 2014 1:24:43 PM UTC-7, Tim Golden wrote: I'm not 100% sure what your scenario is, but you can certainly help yourself and us by running the same test on the raw interpreter and then under PyScripter to determine if the behaviour is to do with IDLE or with Python itself. My half-guess is that PyScripter starts a new process to run your code, possibly killing any pre-existing process first. That's if I've understood the situation you're describing. Could you come back with a little more detail? Specifically: whether what you're seeing happens only from within PyScripter, or only not from within PyScripter, or something else? I think you're right about PyScripter controlling the process. I don't run scripts through the command line as a matter of practice. But I just tried running my script through the command line, with Excel closed, and it opened the Excel file just as I expected. Then I went back to the command line and ran it again, and it didn't close Excel. It gave me the error I was expecting from zipfile not being able to access the file (because it is currently open). I even left it open and ran another script that also creates and launches an Excel workbook, and it again did not close Excel. So this quirk is coming from PyScripter, which is a shame, because I don't think it's under development, so it won't be fixed. Josh -- https://mail.python.org/mailman/listinfo/python-list
Re: os.startfile hanging onto the launched app, or my IDE?
On 06/09/2014 03:21 PM, Josh English wrote: So this quirk is coming from PyScripter, which is a shame, because I don't think it's under development, so it won't be fixed. The nice thing about Python code is you can at least fix your copy. :) -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list
Re: Is MVC Design Pattern good enough?
On Tue, Jun 10, 2014 at 12:57 PM, Stefan Ram r...@zedat.fu-berlin.de wrote: AFAIK standard Python has no GUI library at all, so Java SE and C# already are better than Python insofar as they include a standard GUI toolkit at all! In Python one first has to choose between more than a dozen of »GUI frameworks«, and then the result of the comparison between Python and Java SE would depend on that choice. Define standard Python. I'm pretty sure a stock-standard Python installation includes tkinter, although that may not necessarily be true on all platforms. But personally, I'd rather use GTK than Tkinter. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Is MVC Design Pattern good enough?
On Tue, Jun 10, 2014 at 1:54 PM, Stefan Ram r...@zedat.fu-berlin.de wrote: Chris Angelico ros...@gmail.com writes: On Tue, Jun 10, 2014 at 12:57 PM, Stefan Ram r...@zedat.fu-berlin.de wrote: AFAIK standard Python has no GUI library at all, so Java SE and C# already are better than Python insofar as they include a standard GUI toolkit at all! In Python one first has to choose between more than a dozen of »GUI frameworks«, and then the result of the comparison between Python and Java SE would depend on that choice. Define standard Python. »Standard Python 2.7.6 (or 3.4.1)« contains all those and only those features that are available under every implementation of Python 2.7.6 (or 3.4.1, respectively). It is the set of features an implementation must compass to call itself »an implementation of Python 2.7.6 (or 3.4.1, respectively)«. The os module would have to be considered part of the standard library, but its contents differ according to your OS. And quite a bit of stuff isn't in a python3-minimal package on Debian - such as the threading module, which is definitely part of the standard library. So is python3-minimal not properly Python 3? By the way, how come when I quote your post and send stuff back UTF-8, your mailer then quotes it, doesn't transcode it, and sticks an ISO-8859-1 header on it? Note above, your quotes are borked. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: os.startfile hanging onto the launched app, or my IDE?
On 09/06/2014 23:31, Ethan Furman wrote: On 06/09/2014 03:21 PM, Josh English wrote: So this quirk is coming from PyScripter, which is a shame, because I don't think it's under development, so it won't be fixed. The nice thing about Python code is you can at least fix your copy. :) IIRC, PyScripter is actually written in Delphi! TJG -- https://mail.python.org/mailman/listinfo/python-list
Re: OT: This Swift thing
On 6/06/2014 9:11 PM, Alain Ketterlin wrote: The nice thing with optional type annotations and an hypothetical Python compiler would be that you could, e.g., continue using the interpreter during development and then compile for production use. s/annotations/decorators/ and you effectively have Cython's pure Python mode. -- https://mail.python.org/mailman/listinfo/python-list
Re: Suds 4.1 Beta Assertion Failure
1stpo...@gmail.com writes: Hello group, I have been using Python suds to try to consume a web service. I am able to use tools like SOAPUI and it works but when I it in python I get Assertion Failure. ... suds.WebFault: Server raised fault: 'Assertion failure: criteria at line 296 of /net/adcnas420/export/ifarm_base/ifarm_views/aime_bifndn_430300/bifndn/analytics_web/main/project/webformatengine/formatengine.cpp' This is a message from the webserver. The Assertion failure happens there (in the server) and not on the client side. Usually, an Assertion failure is a programming error (of the component which checks the assertion). However, in some cases, other components (such as the client, in your case) might be directly responsible or have at least triggered the problem. I would approach as follows: Tell suds to log the outgoing messages; lock at those messages whether they are correct. If they are, contact the web service administrator and ask him for help. -- https://mail.python.org/mailman/listinfo/python-list
[issue21677] Exception context set to string by BufferedWriter.close()
Roundup Robot added the comment: New changeset a3b7b89da34f by Serhiy Storchaka in branch '3.4': Issue #21677: Fixed chaining nonnormalized exceptions in io close() methods. http://hg.python.org/cpython/rev/a3b7b89da34f New changeset d6ac4b6020b9 by Serhiy Storchaka in branch 'default': Issue #21677: Fixed chaining nonnormalized exceptions in io close() methods. http://hg.python.org/cpython/rev/d6ac4b6020b9 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21677 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21679] Prevent extraneous fstat during open()
Bohuslav Slavek Kabrda added the comment: Thanks a lot for the code review! I'm attaching a revised version of the patch. Fixes I made: - added check whether PyLong_AsLong returned an error - removed ADD_INTERNED(_blksize) and PyObject *_PyIO_str__blksize; - I noticed that these are only necessary when exported by _iomodule.h, which isn't needed for _blksize ATM - moved blksize to a place of fileio structure where it won't create unnecessary padding I hope attaching the version 2 of the patch here is ok, if I should have attached it in the code review tool somehow, please let me know. -- Added file: http://bugs.python.org/file35540/python3-remove-extraneous-fstat-on-file-open-v2.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21679 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21256] Sort keyword arguments in mock _format_call_signature
Roundup Robot added the comment: New changeset 8e05e15901a8 by Kushal Das in branch 'default': Closes #21256: Printout of keyword args in deterministic order in mock calls. http://hg.python.org/cpython/rev/8e05e15901a8 -- nosy: +python-dev resolution: - fixed stage: needs patch - resolved status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21256 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21692] Wrong order of expected/actual for assert_called_once_with
Michael Foord added the comment: As David points out - in your example the actual call made is m.some_method('foo', 'bar'). Your assertion (the expectation) is m.some_method.assert_called_once_with('foo', 'baz'). So the traceback is correct. I don't think the ordering of expected/actual in the output matters. -- resolution: - not a bug status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21692 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21310] ResourceWarning when open() fails with io.UnsupportedOperation: File or stream is not seekable
Roundup Robot added the comment: New changeset 1e30ecbfe181 by Serhiy Storchaka in branch '2.7': Issue #21310: Fixed possible resource leak in failed open(). http://hg.python.org/cpython/rev/1e30ecbfe181 New changeset 17e7934905ab by Serhiy Storchaka in branch '3.4': Issue #21310: Fixed possible resource leak in failed open(). http://hg.python.org/cpython/rev/17e7934905ab New changeset 9c724c428e1f by Serhiy Storchaka in branch 'default': Issue #21310: Fixed possible resource leak in failed open(). http://hg.python.org/cpython/rev/9c724c428e1f -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21310 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21697] shutil.copytree() handles symbolic directory incorrectly
New submission from Shajunxing: While using shutil.copytree() and the source containing symbolic directory (not symbolic file), an error will be raised. I checked the source code and found an obvlous mistake: shutil.copytree() using os.path.islink() to checker whether the source is a symbolic link, it's okay, but after doing this, os.path.isdir() should be called because a symbolic link may either be a file or a directry, shutil.copytree() just treated all of them as file, and invoke copy_function to copy it, so error happens. I don't know whether newer versions have fixed this bug, but I googled it and found nothing. -- components: Library (Lib) files: 截图 - 2014年06月09日 - 21时14分13秒.png messages: 220088 nosy: shajunxing priority: normal severity: normal status: open title: shutil.copytree() handles symbolic directory incorrectly type: behavior versions: Python 3.3 Added file: http://bugs.python.org/file35541/截图 - 2014年06月09日 - 21时14分13秒.png ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21697 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21698] Platform.win32_ver() shows different values than expected on Windows 8.1
New submission from Aviv Avital: On Windows 8.1, win32_ver() returns a Windows 8 version number: C:\\Python27\python.exe Python 2.7.5 (default, May 15 2013, 22:43:36) [MSC v.1500 32 bit (Intel)] on win32 Type help, copyright, credits or license for more information. import platform platform.win32_ver() ('8', '6.2.9200', '', 'Multiprocessor Free') quit() C:\ver Microsoft Windows [Version 6.3.9600] C:\ -- components: Windows messages: 220089 nosy: AvivAvital priority: normal severity: normal status: open title: Platform.win32_ver() shows different values than expected on Windows 8.1 type: behavior versions: Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21698 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14758] SMTPServer of smptd does not support binding to an IPv6 address
Milan Oberkirch added the comment: I applied your suggestions. -- Added file: http://bugs.python.org/file35542/smtpd_060914.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14758 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14758] SMTPServer of smptd does not support binding to an IPv6 address
Changes by Milan Oberkirch milan...@oberkirch.org: -- nosy: +jesstess ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14758 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21698] Platform.win32_ver() shows different values than expected on Windows 8.1
Changes by R. David Murray rdmur...@bitdance.com: -- nosy: +lemburg ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21698 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20903] smtplib.SMTP raises socket.timeout
Milan Oberkirch added the comment: Should this task get closed? (see comment above) -- nosy: +jesstess ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20903 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11437] IDLE crash on startup with typo in config-keys.cfg
Mark Lawrence added the comment: @Roger, Andrew could you pick this up again? -- nosy: +BreamoreBoy ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11437 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11437] IDLE crash on startup with typo in config-keys.cfg
Changes by Saimadhav Heblikar saimadhavhebli...@gmail.com: -- nosy: +sahutd ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11437 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19143] Finding the Windows version getting messier (detect windows 8.1?)
Changes by STINNER Victor victor.stin...@gmail.com: -- title: Finding the Windows version getting messier - Finding the Windows version getting messier (detect windows 8.1?) ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19143 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21698] Platform.win32_ver() shows different values than expected on Windows 8.1
STINNER Victor added the comment: This issue is a duplicate of the issue #19143. -- nosy: +haypo resolution: - duplicate status: open - closed superseder: - Finding the Windows version getting messier ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21698 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12739] read stuck with multithreading and simultaneous subprocess.Popen
Changes by Geoffrey Bache gjb1...@users.sourceforge.net: -- nosy: +gjb1002 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12739 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12739] read stuck with multithreading and simultaneous subprocess.Popen
Geoffrey Bache added the comment: Just ran into this on Python 2.6 also. -- versions: +Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12739 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12739] read stuck with multithreading and simultaneous subprocess.Popen
STINNER Victor added the comment: The PEP 446 partially fixes this issue. The issue #19764 should fix it completly. Since you are using Python 2, you should not wait until the issue is fixed, but work around it. To workaround the issue: use you own lock around the creation of processes. Example: --- lock = threading.Lock() ... def run_command(...): with lock: proc = subprocess.Popen(...) return proc.communicate() --- The problem is that a thread B may inherit the handle of a pipe from handle A because the pip is marked as inheritable, and the subprocess module must use CreateProcess() with bInheritHandles parameter set to True to be able to redirect stdout. Said differently: the subprocess is not thread-safe, you have to use your own lock to workaround race conditions. -- nosy: +haypo, sbt ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12739 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12739] read stuck with multithreading and simultaneous subprocess.Popen
STINNER Victor added the comment: Oh by the way, this issue was fixed on UNIX in Python 3.2: all file descriptors are now closed by default (close_fds=True by default on UNIX). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12739 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21699] Windows Python 3.4.1 pyvenv doesn't work in directories with spaces.
New submission from Justin Engel: Venv virtual environments don't work with spaces in the path. (env) C:\My Directory\path pip -V Fatal error in launcher: Unable to create process using 'C:\My Directory\path\env\Scripts\python.exe C:\My Directory\path\env\Scripts\pip.exe -V' -- components: Windows messages: 220098 nosy: Justin.Engel priority: normal severity: normal status: open title: Windows Python 3.4.1 pyvenv doesn't work in directories with spaces. type: crash versions: Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21699 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12739] read stuck with multithreading and simultaneous subprocess.Popen
Geoffrey Bache added the comment: Thanks Victor, yes I already created my own lock which fixed the issue for me. Maybe it would be worth adding a note to the documentation about this in the meantime (especially for Python 2)? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12739 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21699] Windows Python 3.4.1 pyvenv doesn't work in directories with spaces.
R. David Murray added the comment: This *can't* work on Linux (see issue 20622). I don't know if it is possible to make it work on Windows, but I wonder: even if it is should we do so, since the point of the launcher is to make shebang lines work on Windows more or less how they do on Unix? (The counter argument is that paths with spaces are *much* more common on Windows.) -- nosy: +r.david.murray, vinay.sajip ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21699 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21463] RuntimeError when URLopener.ftpcache is full
Erik Bray added the comment: Thanks Skyler for finishing the job. I got busy/distracted. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21463 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21685] zipfile module doesn't properly compress odt documents
Raimondo Giammanco added the comment: hit F9 ?!? I feel ashamed. The need to recalculate the fields simply slipped my mind. Of course, in some way Writer has to be told about the strings replacement. Maybe could my fault be partially justifiable if one consider the autoupdate behaviour with the uncompressed documents? Anyway, the workaround to zip without compression is ok for me as LibreOffice actually will compress the document on first saving. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21685 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21677] Exception context set to string by BufferedWriter.close()
Serhiy Storchaka added the comment: Thank you Martin for your report. -- resolution: - fixed stage: patch review - resolved status: open - closed versions: -Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21677 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21310] ResourceWarning when open() fails with io.UnsupportedOperation: File or stream is not seekable
Serhiy Storchaka added the comment: Thanks Victor for the review. Thanks Martin for the report. -- resolution: - fixed stage: patch review - resolved status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21310 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21372] multiprocessing.util.register_after_fork inconsistency
Marc Schlaich added the comment: Your statement is not correct, it does work on Windows (where fork is not available) if you register the hook on module level instead of in `__main__`. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21372 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21688] Improved error msg for make.bat htmlhelp
Zachary Ware added the comment: Could you give me the exact message you get currently? If it's just 'C:\Program' is not recognized as an internal or external command, operable program or batch file., that's a different issue than if the whole path to hhc.exe is displayed. Otherwise, I like the patch, except you can reuse the %HTMLHELP% variable instead of reconstructing it from %_PRGMFLS%. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21688 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11437] IDLE crash on startup with typo in config-keys.cfg
Terry J. Reedy added the comment: Mark, they are both inactive at the moment. There are a number of issue around configuration, especially key bindings. I think the whole process needs review and redoing. For instance, I understand Roger as saying that the problematical known-invalid list (set) is needed because GetCurrentKeySet is called repeatedly, once for each extension. I want to look into fixing the repeated calls, which will increase with more extensions, and possibly eliminate the need for known-invalid. Another redesign: I think Control-Key-x should automatically mean Control-Key-X, and ditto for Alt-Key-x, and that we should not need both in config-keys even if tk requires separate bind calls. Saimadhav, we should try to do some validation of the key bindings in the unittest for configurations. The pattern seems to be optional Control-, Alt-, or Meta- optional Shift- required Key- required ascii key, bracketleft/right, or Uppercase-key-name, -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11437 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19143] Finding the Windows version getting messier (detect windows 8.1?)
Changes by Antoine Pitrou pit...@free.fr: -- nosy: +steve.dower ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19143 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21659] IDLE: One corner calltip case
Serhiy Storchaka added the comment: Here is a patch. Now names of starred arguments never conflict with other parameters. -- keywords: +patch stage: - patch review Added file: http://bugs.python.org/file35543/calltips_starred_names.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21659 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13924] Mercurial robots.txt should let robots crawl landing pages.
Antoine Pitrou added the comment: Yes, I think we should whitelist rather than blacklist. The problem with letting engines index the repositories is the sheer resource cost when they fetch many heavy pages (such as annotate, etc.). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13924 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20699] Behavior of ZipFile with file-like object and BufferedWriter.
Changes by Ned Deily n...@acm.org: -- nosy: +benjamin.peterson, pitrou ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20699 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18039] dbm.open(..., flag=n) does not work and does not give a warning
Serhiy Storchaka added the comment: With this patch 2 of 4 modes ('c' and 'n') work as for other dbm modules. So it would be better to document that 'r' and 'w' work nonstandard, than document that 'n' is not ignored. And while you are here, may be add a warning in 'r' and 'w' mode when the file does not exist? -- assignee: - serhiy.storchaka ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18039 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21685] zipfile module doesn't properly compress odt documents
R. David Murray added the comment: So if I'm understanding correctly the python update to the file happens correctly in both cases, and the issue with the update not being immediately visible is an issue on the OpenOffice side of things. So I'm closing this as a 3rd party bug (though it sounds like it may not really be a bug). -- nosy: +r.david.murray resolution: - third party stage: - resolved status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21685 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21697] shutil.copytree() handles symbolic directory incorrectly
Ned Deily added the comment: Thanks for the report. The bug is still present in the 3.4 and default (what will become the 3.5 release) branches; the 3.3 branch now only accepts security fixes. 2.7 does not fail. Would you be interested in producing a patch for the problem? -- keywords: +easy nosy: +ned.deily stage: - needs patch versions: +Python 3.4, Python 3.5 -Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21697 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18039] dbm.open(..., flag=n) does not work and does not give a warning
Claudiu.Popa added the comment: Thanks, Serhiy. Here's the new version of the patch. Hope that the warning message is clear enough. -- Added file: http://bugs.python.org/file35544/issue18039_1.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18039 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21659] IDLE: One corner calltip case
Terry J. Reedy added the comment: Looks good on reading. When I get my repository copy repaired, I will test and either apply or report back. In 2.7 Lib/*.py, 9 module use 'kwds' and 28 use 'kwargs', so I will accept that change. -- assignee: - terry.reedy stage: patch review - commit review ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21659 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8378] PYTHONSTARTUP is not run by default when Idle is started
Mark Lawrence added the comment: Terry what is your opinion on this? -- nosy: +BreamoreBoy, terry.reedy versions: +Python 3.5 -Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8378 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21692] Wrong order of expected/actual for assert_called_once_with
Fei Long Wang added the comment: Okay, I can see your point now. Thanks for the clarification. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21692 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20903] smtplib.SMTP raises socket.timeout
Roundup Robot added the comment: New changeset 6cd64ef6fc95 by R David Murray in branch '2.7': #20903: clarify what happens when an smtp connection timeout occurs. http://hg.python.org/cpython/rev/6cd64ef6fc95 New changeset ca88bcfa5c15 by R David Murray in branch '3.4': #20903: clarify what happens when an smtp connection timeout occurs. http://hg.python.org/cpython/rev/ca88bcfa5c15 New changeset 20225460ae0f by R David Murray in branch 'default': Merge: #20903: clarify what happens when an smtp connection timeout occurs. http://hg.python.org/cpython/rev/20225460ae0f -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20903 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20903] smtplib.SMTP raises socket.timeout
R. David Murray added the comment: Well, now that I applied your patch it can be :) Thanks. -- resolution: - fixed stage: needs patch - resolved status: open - closed versions: -Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20903 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5594] IDLE startup configuration
Changes by Terry J. Reedy tjre...@udel.edu: -- assignee: kbk - versions: +Python 2.7, Python 3.4, Python 3.5 -Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5594 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8378] PYTHONSTARTUP is not run by default when Idle is started
Terry J. Reedy added the comment: David, thank you for the research on related issues. #5233 explicitly includes this proposal: The former effect of -s would now be the default,. So I am closing this as a partial duplicate. I will explain here why I reject this. -- resolution: - duplicate stage: - resolved status: open - closed superseder: - Enhance 2.7 IDLE to exec IDLESTARTUP/PYTHONSTARTUP on restart ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8378 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com