Certificate generator
A certificate generator, from a SVG to a lot of PDFs: https://github.com/facundobatista/certg Documentation (it's very simple to use) and a full fledged example, in the project ^. Regards, -- .Facundo Blog: http://www.taniquetil.com.ar/plog/ PyAr: http://www.python.org/ar/ Twitter: @facundobatista -- https://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations/
devpi 1.2 releases: many improvements + py33 support
The devpi-{server,client}-1.2 releases bring a lot of refinements and improvements for serving and interacting with your own pypi indexes: - devpi-server serves release files from URLs containing a MD5 hash allowing safe serving of those files through nginx - devpi-server's USER/INDEX urls can now be used directly with pip/easy_install without the previously required (and still valid) ``+simple/`` suffix. - ``devpi use --set-cfg`` reads and writes pip/easy_install configuration files, making those installers pick up the in-use index seemlessly. You can even do ``devpi use --always-set-cfg`` to always set those config files when issuing a devpi use afterwards. - ``devpi upload`` got many improvements: - versioned files (git and hg) will be exported to a clean directory prior to the build step - distutils/setup.py is now only used for building a package - documentation upload is tied to a version now - you can directly upload distribution files, including wheel files - both devpi-server and devpi-client are python3.3 compatible now and depend on a new devpi-common package which consolidates various pypi-interaction aspects to avoid code duplication. Also, global http proxy settings are honoured. If you have an existing devpi-server-1.1 installation serving your own packages you can install devpi-server=1.2 and migrate the data with:: devpi-server --upgrade-state [--serverdir your_server_dir] This upgrades your server state in-place. Please make sure you backup your serverdir ahead of doing the upgrade (default location is ~/.devpi/server). WARNING: ``devpi-server --gendeploy`` is deprecated and will be removed probably in favor of just generating example config files for nginx/supervisor/cron. Also ``devpi install`` is deprecated now in favor of using pip/easy_install directly (see also the --set-cfg and --always-set-cfg options). For more information please refer to the extensive documentation at: http://doc.devpi.net/ or check the CHANGELOG below. have fun, holger krekel 1.2 devpi-server: - serve links to files on simple pages and index root as relative paths so that it works more nicely with proxy-pass server setups. fixes issue56. - make devpi-server and devpi-common python3.3 compatible, addresses issue57 - use system http/s proxy settings from devpi-server. fixes issue58. - refactor locations to allow nginx serving static files more directly. Also updated nginx template accordingly. - rework --upgrade-state to detect the state version of the server dir and create an appropriate virtualenv with a devpi-server install in order to export data, and then import that version. - allow to use /user/index as indexserver url for pip/easy_install by redirecting non-json queries to /user/index/PROJ[/] to /user/index/+simple/PROJ/ - fix submission of multi-value fields like classifiers or platform (previously they would be wrongly collapsed to become the last value of a list) - fix normalization import/export issue: pypi names take precendence for defining the real name of a project. - always store uploaded documentation with a version. While devpi upload will make sure to pass in the version, setup.py upload_docs will not pass in a version. In the latter case, devpi-server assumes the documentation belongs to the highest yet registered release. This change requires exporting with devpi-1.1 and importing with devpi-1.2 in order to properly store versioned docs internally. - use types/url/metadata/validation functionality of new depdency devpi_common - internal cleanup using pytest-flakes - make devpi-server use a proper UserAgent string devpi-client: - devpi list and devpi remove now accept a pip/setuptools style requirement like pkg=1.0 instead of the former for limited pkg-1.0. - make devpi-client fully work with python3.3 and fix test bugs - use system http/s proxy settings. fixes issue58. - add devpi test -c tox.ini package to use a particular (external) tox.ini for running tox with the unpackaged package. also add --fallback-ini tox.ini option which will only be used if the download package has no tox.ini. - new devpi use --set-cfg option to set pip/easy_install configuration files when changing indexes. Also new devpi use --always-set-cfg=yes option if you want to imply --set-cfg on future devpi use invocations and devpi use --always-st-cfg=no to disable this implication. - support git and hg for exporting all versioned files of a directory before performing the build step when uploading - improve how upload works: setup.py is only used for building docs and release files but not for the remote upload part. This gets rid of a number of hacks that were done trying to get the Python shipped distutils to pick the proper devpi index and allows proper SSL verification on Python2.6 onwards. - upload: show response when uploading
ANN: NumPy 1.8.0 release.
I am pleased to announce the availability of NumPy 1.8.0. This release is the culmination of over a years worth of work by the NumPy team and contains many fixes, enhancements, and new features. Highlights are: - New, no 2to3, Python 2 and Python 3 are supported by a common code base. - New, gufuncs for linear algebra, enabling operations on stacked arrays. - New, inplace fancy indexing for ufuncs with the ``.at`` method. - New, ``partition`` function, partial sorting via selection for fast median. - New, ``nanmean``, ``nanvar``, and ``nanstd`` functions skipping NaNs. - New, ``full`` and ``full_like`` functions to create value initialized arrays. - New, ``PyUFunc_RegisterLoopForDescr``, better ufunc support for user dtypes. - Numerous performance improvements in many areas. This release requires Python 2.6, 2.7 or 3.2-3.3, support for Python 2.4 and 2.5 has been dropped. Sources and binaries can be found at http://sourceforge.net/projects/numpy/files/NumPy/1.8.0/. Some 119 people contributed to this release. This is a remarkable increase and shows that there is still life in this venerable code that had its beginning in Numeric some 18 years ago. Many thanks to you all. Enjoy, Chuck NumPy 1.8.0 Release Notes * This release supports Python 2.6 -2.7 and 3.2 - 3.3. Highlights == * New, no 2to3, Python 2 and Python 3 are supported by a common code base. * New, gufuncs for linear algebra, enabling operations on stacked arrays. * New, inplace fancy indexing for ufuncs with the ``.at`` method. * New, ``partition`` function, partial sorting via selection for fast median. * New, ``nanmean``, ``nanvar``, and ``nanstd`` functions skipping NaNs. * New, ``full`` and ``full_like`` functions to create value initialized arrays. * New, ``PyUFunc_RegisterLoopForDescr``, better ufunc support for user dtypes. * Numerous performance improvements in many areas. Dropped Support === Support for Python versions 2.4 and 2.5 has been dropped, Support for SCons has been removed. Future Changes == The Datetime64 type remains experimental in this release. In 1.9 there will probably be some changes to make it more useable. The diagonal method currently returns a new array and raises a FutureWarning. In 1.9 it will return a readonly view. Multiple field selection from a array of structured type currently returns a new array and raises a FutureWarning. In 1.9 it will return a readonly view. The numpy/oldnumeric and numpy/numarray compatibility modules will be removed in 1.9. Compatibility notes === The doc/sphinxext content has been moved into its own github repository, and is included in numpy as a submodule. See the instructions in doc/HOWTO_BUILD_DOCS.rst.txt for how to access the content. .. _numpydoc: https://github.com/numpy/numpydoc The hash function of numpy.void scalars has been changed. Previously the pointer to the data was hashed as an integer. Now, the hash function uses the tuple-hash algorithm to combine the hash functions of the elements of the scalar, but only if the scalar is read-only. Numpy has switched its build system to using 'separate compilation' by default. In previous releases this was supported, but not default. This should produce the same results as the old system, but if you're trying to do something complicated like link numpy statically or using an unusual compiler, then it's possible you will encounter problems. If so, please file a bug and as a temporary workaround you can re-enable the old build system by exporting the shell variable NPY_SEPARATE_COMPILATION=0. For the AdvancedNew iterator the ``oa_ndim`` flag should now be -1 to indicate that no ``op_axes`` and ``itershape`` are passed in. The ``oa_ndim == 0`` case, now indicates a 0-D iteration and ``op_axes`` being NULL and the old usage is deprecated. This does not effect the ``NpyIter_New`` or ``NpyIter_MultiNew`` functions. The functions nanargmin and nanargmax now return np.iinfo['intp'].min for the index in all-NaN slices. Previously the functions would raise a ValueError for array returns and NaN for scalar returns. NPY_RELAXED_STRIDES_CHECKING There is a new compile time environment variable ``NPY_RELAXED_STRIDES_CHECKING``. If this variable is set to 1, then numpy will consider more arrays to be C- or F-contiguous -- for example, it becomes possible to have a column vector which is considered both C- and F-contiguous simultaneously. The new definition is more accurate, allows for faster code that makes fewer unnecessary copies, and simplifies numpy's code internally. However, it may also break third-party libraries that make too-strong assumptions about the stride values of C- and F-contiguous arrays. (It is also currently known that this breaks Cython code using memoryviews, which will be fixed in Cython.) THIS WILL BECOME THE DEFAULT IN A FUTURE RELEASE, SO PLEASE
Re: Basic Python Questions - Oct. 31, 2013
E.D.G. edgrs...@ix.netcom.com wrote in message news:udgdnadga6n9vu_pnz2dnuvz_umdn...@earthlink.com... Thanks for all of the comments. I have been away from my Internet connection for several days and could not respond to them when they were first posted here. The comments have all been considered. And I am discussing them with other researchers that I work with. Since Perl has a calculation speed limit that is probably not easy to get around, before too long another language will be selected for initially doing certain things such as performing calculations and plotting charts. And the existing Perl code might then be gradually translated into that new language. Gnuplot is presently being used to draw charts. And it works. But it has its own limitations such as with its interaction speed when it is used for working with Perl program generated data files. My main, complex programs won't be run at Web sites. They will instead continue to be available as downloadable exe programs. The CGI (or whatever) programming work would involve relatively simple programs. But they would need to be able to generate charts that would be displayed on Web pages. That sounds like it is probably fairly easy to do using Python. A Perl - Gnuplot combination is also supposed to be able to do that. But so far I have not seen any good explanations for how to actually get Gnuplot to run as a callable CGI program. So other programs such as Python are being considered. -- https://mail.python.org/mailman/listinfo/python-list
Re: How to add a current string into an already existing list
Nick the Gr33k wrote: I just want a mysql column type that can be eligible to store an array of elements, a list that is, no need for having a seperate extra table for that if we can have a column that can store a list of values. Relational database systems typically don't provide any such type, because it's not the recommended way of storing that kind of data in a relational database. The recommended way is to use a secondary table, as has been pointed out. You're making things difficult for yourself by refusing to consider that solution. -- Greg -- https://mail.python.org/mailman/listinfo/python-list
zero argument member functions versus properties
Python makes it very easy to turn a zero argument member function into a property (hooray!) by simply adding the @property decorator. (Meme for well thought py feature - Guido was here) But the ease with which you can do this makes the zero argument member function or property discussion trickier for me. Generally my sense here is there are two extremes 1- the zero argument function is sort of factory-like. It potentially has non-trivial run time, or it substitutes calling a class constructor when building certain objects. 2- it simply retrieves a stored value (perhaps lazily evaluating it first) so 1 should clearly be a zero argument member function. 2 should be a method. Other than that, I say when in doubt, go with zero argument method. In particular something in my gut says that if the thing I'm returning is itself a function, than don't go with property. In other words foo.bar()(x) self documents that bar returns a function whereas foo.bar(x) looks like bar is a one argument member function of foo, as opposed to a property that returns a 1 argument function I also think that foo.size() implies that foo performs a count every time it's called, and foo.size implies that the run time will amortize to O(1) somehow (usually with lazy eval). So the implementation should drive the property or not decision. Sound a bit right? Seems like some of the energetic posters will have fun with this one, re:less. -- https://mail.python.org/mailman/listinfo/python-list
Re: zero argument member functions versus properties
I just said 1- the zero argument function is sort of factory-like. It potentially has non-trivial run time, or it substitutes calling a class constructor when building certain objects. 2- it simply retrieves a stored value (perhaps lazily evaluating it first) so 1 should clearly be a zero argument member function. 2 should be a method. typo. Obviously, 2 should be a property. -- https://mail.python.org/mailman/listinfo/python-list
Re: Basic Python Questions - Oct. 31, 2013
Mark Lawrence breamore...@yahoo.co.uk wrote in message news:mailman.1873.1383227352.18130.python-l...@python.org... https://pypi.python.org/pypi/pywinauto/0.3.9 or http://stackoverflow.com/questions/1823762/sendkeys-for-python-3-1-on-windows Python SendKey looks like it probably works about the same as the Perl version. It prints or sends control information to the active window. -- https://mail.python.org/mailman/listinfo/python-list
Re: Basic Python Questions - Oct. 31, 2013
William Ray Wing w...@mac.com wrote in message news:mailman.1934.1383320554.18130.python-l...@python.org... If you look here: http://wiki.wxpython.org/MatplotlibFourierDemo A suggestion that I would like to add is that when people make Demo programs like that available they might want to create exe versions that people can download and try without installing the original programming language. However, there might have been an exe version at that Web site and I just didn't see it. I myself use expendable backup computers (Windows XP) for testing new exe programs so that problems are not created for my primary computer. If something goes wrong on one of the backup systems it is simply told to go back to an earlier restore point. -- https://mail.python.org/mailman/listinfo/python-list
Re: Algorithm that makes maximum compression of completly diffused data.
Congratulations Jonas. My kill file for this list used to have only one name, but now has 2. You have more patience than I! Jonas just made mine seven. :) Gosh, don't kill the guy. It's not an obvious thing to hardly anyone but computer scientists. It's an easy mistake to make. -- MarkJ Tacoma, Washington -- https://mail.python.org/mailman/listinfo/python-list
Re: zero argument member functions versus properties
On Sat, 02 Nov 2013 23:09:09 -0700, Peter Cacioppi wrote: Python makes it very easy to turn a zero argument member function into a property (hooray!) by simply adding the @property decorator. (Meme for well thought py feature - Guido was here) It is well-thought out, but it's also quite late in Python's history. Properties didn't get added until new style classes and descriptors, which was in version 2.2. I'm not sure if it's Guido to thank for them. But the ease with which you can do this makes the zero argument member function or property discussion trickier for me. Generally my sense here is there are two extremes 1- the zero argument function is sort of factory-like. It potentially has non-trivial run time, or it substitutes calling a class constructor when building certain objects. 2- it simply retrieves a stored value (perhaps lazily evaluating it first) I normally go with something like this: Something with a significant overhead (e.g. memory or running time) should be a method. The fact that you have to call it is a hint that it may require non-trivial resources/time to perform. On the other hand, something that feels like it ought to be an inherent attribute of an object should be a property if you need it to be lazily calculated, or a standard attribute if you want to give direct access to it. For example, imagine an object representing a printable page. The paper size (A4, A3, foolscap, etc.) is an inherent attribute of a page, so it ought to be accessed using attribute notation: mypage.size If this is lazily generated, or if you want to protect the attribute with data validation, you should use a property. Otherwise, an ordinary data attribute is acceptable. (This isn't Java or Ruby, where data-hiding is compulsory :-) On the other hand, the Postscript image of the page is not inherent to the page, and it is also expensive to generate. So it ought to be generated lazily, only when needed, but using method notation: mypage.postscript() Page margins are intermediate. They feel kind of inherent to a page, but not exactly -- in a complex document, the margins may depend on the section you are in. Margins can vary depending on whether the page is at the left or the right. So page margins probably ought to be computed attributes. But they probably won't be terribly expensive to compute. So here I would again go with a property, assuming the page object knows whether it is on the left or the right, and which section it belongs to. But if somebody else decided that margins ought to be an explicit method, I wouldn't consider them wrong. It is a matter of personal taste. [...] I also think that foo.size() implies that foo performs a count every time it's called, and foo.size implies that the run time will amortize to O(1) somehow (usually with lazy eval). So the implementation should drive the property or not decision. I think that is reasonable. -- Steven -- https://mail.python.org/mailman/listinfo/python-list
Re: Basic Python Questions - Oct. 31, 2013
On Sunday, November 3, 2013 11:15:48 AM UTC+5:30, E.D.G. wrote: rusi wrote: Not sure what will… you may look at Julia: http://julialang.org/ That program language speed comparison table looks quite interesting. And I asked some of the other people that I work with to take a look at the Web page. One or two of them might want to consider using it instead of XBasic assuming the calculation speeds and chart generation capabilities are at least roughly equal. If either of them decides to move in that direction I will probably try using it myself. And please post back your findings when you have some concrete data For the record I have exactly zero experience with Julia. -- https://mail.python.org/mailman/listinfo/python-list
Re: zero argument member functions versus properties
Steve said: (This isn't Java or Ruby, where data-hiding is compulsory :-) (You could add C++ and C# to this list). This is golden nugget for me. The old synapses are pretty well grooved to think of data hiding as good hygiene. Even though I've read a fair bit of Python text I still need to be reminded of the little idiomatic differences between Py and all the languages made obsolete by Py ;) Thanks. -- https://mail.python.org/mailman/listinfo/python-list
Re: Basic Python Questions - Oct. 31, 2013
On Sun, 03 Nov 2013 01:02:24 -0500, E.D.G. wrote: [...] Since Perl has a calculation speed limit that is probably not easy to get around, before too long another language will be selected for initially doing certain things such as performing calculations and plotting charts. And the existing Perl code might then be gradually translated into that new language. The nice things about Python are that it makes a great glue language for putting together components written in low-level languages like C and Fortran, and that there is a rich ecosystem of products for speeding it up in various ways. So when you hit the speed limits of pure Python, you have lots of options. In no particular order: * try using another Python compiler: PyPy is probably the most mature of the stand-alone optimizing compilers, and you can expect to double the speed of typical Python code, but there are others; * use numpy and scipy for vectorized mathematical routines; * re-write critical code as C or Fortran libraries; * use Pyrex (possibly unmaintained now) or Cython to write C extensions in a Python-like language; * use Psyco or Numba (JIT specialising compilers for Python); * use Theano (optimizing computer algebra system compiler); * use ctypes to call C functions directly; * use other products like Boost, Weave, and more. See, for example: http://jakevdp.github.io/blog/2013/06/15/numba-vs-cython-take-2/ http://technicaldiscovery.blogspot.com.au/2011/06/speeding-up-python-numpy-cython-and.html -- Steven -- https://mail.python.org/mailman/listinfo/python-list
Re: zero argument member functions versus properties
Steve said: (This isn't Java or Ruby, where data-hiding is compulsory :-) At the risk of striking a sessile equine, when the attribute shouldn't be modified directly by client code, then you hide it and use a property to allow client code access. It is the idiom of allowing client code to edit read-write data directly via attributes that is pythonic, even though discouraged (somewhat) in other languages. Actually C# is mature enough for this idiom. C# and Python both support getter/setter methods that present as direct attribute access to client code, and thus allow you to refactor the class without breaking backwards compatibility. -- https://mail.python.org/mailman/listinfo/python-list
Re: zero argument member functions versus properties
On Sun, Nov 3, 2013 at 1:06 AM, Peter Cacioppi peter.cacio...@gmail.com wrote: Actually C# is mature enough for this idiom. C# and Python both support getter/setter methods that present as direct attribute access to client code, and thus allow you to refactor the class without breaking backwards compatibility. It's not as clear-cut as it looks in C#. Although refactoring the class in this way doesn't change the API, it does break ABI, which is significant in an environment where virtually everything is distributed in binary form. This happens because a property access compiled to CIL byte code is transformed into a call to a getter or setter method, which is a distinct operation from an ordinary attribute access. Whereas in Python, an attribute access is just compiled as an attribute access no matter what the underlying implementation of that access may end up being at run-time. -- https://mail.python.org/mailman/listinfo/python-list
Re: Basic Python Questions - Oct. 31, 2013
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote in message news:5275fe91$0$29972$c3e8da3$54964...@news.astraweb.com... http://jakevdp.github.io/blog/2013/06/15/numba-vs-cython-take-2/ http://technicaldiscovery.blogspot.com.au/2011/06/speeding-up-python-numpy-cython-and.html It appears that Python can do what is needed. And if the people that I work with want to move in that direction I will probably post a note here stating, This is exactly what we need to do. What would be the best Python download and compiler to do that? It should be a simple matter to determine which compiler and libraries etc. should be used. -- https://mail.python.org/mailman/listinfo/python-list
Re: How to add a current string into an already existing list
Op 03-11-13 07:06, Gregory Ewing schreef: Nick the Gr33k wrote: I just want a mysql column type that can be eligible to store an array of elements, a list that is, no need for having a seperate extra table for that if we can have a column that can store a list of values. Relational database systems typically don't provide any such type, because it's not the recommended way of storing that kind of data in a relational database. The recommended way is to use a secondary table, as has been pointed out. You're making things difficult for yourself by refusing to consider that solution. You are talking to Nikos! The person who choose code because he prefers how it looks over examples of working code. -- Antoon Pardon -- https://mail.python.org/mailman/listinfo/python-list
Re: Basic Python Questions - Oct. 31, 2013
On 03/11/2013 09:47, E.D.G. wrote: Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote in message news:5275fe91$0$29972$c3e8da3$54964...@news.astraweb.com... http://jakevdp.github.io/blog/2013/06/15/numba-vs-cython-take-2/ http://technicaldiscovery.blogspot.com.au/2011/06/speeding-up-python-numpy-cython-and.html It appears that Python can do what is needed. And if the people that I work with want to move in that direction I will probably post a note here stating, This is exactly what we need to do. What would be the best Python download and compiler to do that? It should be a simple matter to determine which compiler and libraries etc. should be used. I've literally just stumbled across this, I've no idea whether it's of any use to you https://speakerdeck.com/ianozsvald/high-performance-python -- Python is the second best programming language in the world. But the best has yet to be invented. Christian Tismer Mark Lawrence -- https://mail.python.org/mailman/listinfo/python-list
Re: multiprocessing: child process race to answer
On Friday, November 1, 2013 10:35:47 PM UTC-4, smhall05 wrote: I am using a basic multiprocessing snippet I found: #- from multiprocessing import Pool def f(x): return x*x if __name__ == '__main__': pool = Pool(processes=4) # start 4 worker processes result = pool.apply_async(f, [10])# evaluate f(10) asynchronously print result.get(timeout=1) print pool.map(f, range(10)) # prints [0, 1, 4,..., 81] #- I am using this code to have each process go off and solve the same problem, just with different inputs to the problem. I need to be able to kill all processes once 1 of n processes has come up with the solution. There will only be one answer. I have tried: sys.exit(0) #this causes the program to hang pool.close() pool.terminate These still allow further processing before the program terminates. What else can I try? I am not able to share the exact code at this time. I can provide more detail if I am unclear. Thank you You could take a look at the Mutiprocessing module capabilities for exchanging objects between processes: http://docs.python.org/3.3/library/multiprocessing.html#exchanging-objects-between-processes -- https://mail.python.org/mailman/listinfo/python-list
Re: multiprocessing: child process race to answer
On 03/11/2013 10:10, capple...@gmail.com wrote: On Friday, November 1, 2013 10:35:47 PM UTC-4, smhall05 wrote: I am using a basic multiprocessing snippet I found: #- from multiprocessing import Pool def f(x): return x*x if __name__ == '__main__': pool = Pool(processes=4) # start 4 worker processes result = pool.apply_async(f, [10])# evaluate f(10) asynchronously print result.get(timeout=1) print pool.map(f, range(10)) # prints [0, 1, 4,..., 81] #- I am using this code to have each process go off and solve the same problem, just with different inputs to the problem. I need to be able to kill all processes once 1 of n processes has come up with the solution. There will only be one answer. I have tried: sys.exit(0) #this causes the program to hang pool.close() pool.terminate These still allow further processing before the program terminates. What else can I try? I am not able to share the exact code at this time. I can provide more detail if I am unclear. Thank you You could take a look at the Mutiprocessing module capabilities for exchanging objects between processes: http://docs.python.org/3.3/library/multiprocessing.html#exchanging-objects-between-processes Would you please read and action this as it prevents the double line spacing that you can observe above, thanks https://wiki.python.org/moin/GoogleGroupsPython -- Python is the second best programming language in the world. But the best has yet to be invented. Christian Tismer Mark Lawrence -- https://mail.python.org/mailman/listinfo/python-list
Re: Debugging decorator
I wrote this decorator: https://gist.github.com/yasar11732/7163528 I ran it with Python 2 and thought it was neat. Most of my work is Python 3. I ran 2to3-3.3 against it and I am getting this error: $ ./simple.py Traceback (most recent call last): File ./simple.py, line 3, in module @debugger.debugging File /home/jason/python/debugger.py, line 41, in debugging new_function_body.append(make_print_node(function %s called % func.__name__)) File /home/jason/python/debugger.py, line 6, in make_print_node return ast.Print(dest=None, values=[ast.Str(s=s)], nl=True) AttributeError: 'module' object has no attribute 'Print' Comparing http://docs.python.org/2/library/ast.html#module-ast against http://docs.python.org/3.3/library/ast.html#module-ast I see that Print has indeed been removed. -- https://mail.python.org/mailman/listinfo/python-list
Re: Parsing multiple lines from text file using regex
Hi, I am having an issue with something that would seem to have an easy solution, but which escapes me. I have configuration files that I would like to parse. The data I am having issue with is a multi-line attribute that has the following structure: banner option banner text delimiter Banner text Banner text Banner text ... banner text delimiter This is an alternative solution someone else posted on this list for a similar problem I had: #!/usr/bin/python3 from itertools import groupby def get_lines_from_file(file_name): with open(file_name) as reader: for line in reader.readlines(): yield(line.strip()) counter = 0 def key_func(x): if x.strip().startswith(banner) and x.strip().endswith(banner text delimiter): global counter counter += 1 return counter for key, group in groupby(get_lines_from_file(my_data), key_func): print(list(group)[1:-1]) -- https://mail.python.org/mailman/listinfo/python-list
Re: Possibly better loop construct, also labels+goto important and on the fly compiler idea.
Op 03-11-13 06:17, Steven D'Aprano schreef: On Sat, 02 Nov 2013 18:22:38 +, Joshua Landau wrote: [...] Sure, you in all probability didn't mean it like that but rurpy isn't uncalled for in raising the concern. Really I just want to remind you that you're both on the same side here. Thanks for the comments Joshua, but I'm afraid I cannot agree. I gave it a lot of thought and I cannot continue to give Rurpy the presumption of good faith any longer. This saddens me, but that's the way it is. I'm trying hard to give up threads like this, where people debate the subjective tone of an email and ever more pedantic arguments about the precise wording. Even when all participants are arguing in good faith, they risk becoming quagmires which go nowhere in dozens of posts. I'm not so sure it is all in good faith. I see a lot of persons digging in their heels and not much effort in trying to understand someone else's point of view. -- Antoon Pardon -- https://mail.python.org/mailman/listinfo/python-list
Re: Algorithm that makes maximum compression of completly diffused data.
On Sunday 03 November 2013 04:40:45 Ethan Furman did opine: On 10/30/2013 01:32 PM, Gene Heskett wrote: Congratulations Jonas. My kill file for this list used to have only one name, but now has 2. You have more patience than I! Jonas just made mine seven. :) -- ~Ethan~ Yeah, well there are a couple others in the mugwump category here yet. I lurk here to try and learn, and baseless arguments are just noise. To be filtered. And its working! But it may be that this old dog has learned his last new trick in the language arena too, too many irons in the fire, and fine tuning machinery to run the GCode I write to carve metal or wood is the primary interest ATM. At 79yo, the short term memory needs help. I'm smart enough to understand that, but it doesn't mean I like it. Its a right PIMA TBE. Cheers, Gene -- There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order. -Ed Howdershelt (Author) All the evidence concerning the universe has not yet been collected, so there's still hope. A pen in the hand of this president is far more dangerous than 200 million guns in the hands of law-abiding citizens. -- https://mail.python.org/mailman/listinfo/python-list
Re: First day beginner to python, add to counter after nested loop
Op 02-11-13 21:19, Tim Roberts schreef: jonas.thornv...@gmail.com wrote: I certainly do not like the old bracket style it was a catastrophe, but in honesty the gui editor of python should have what i propose, a parser that indent automaticly at loops, functions and end. Many editors do that. Vim, which is what I use, certainly does. I promise you it will save millions of hours of bug searching all over world in a month. I suspect you meant dozens rather than millions... Look, both schemes have their pitfalls. With an end requirement, it's easy to have code where the indenting doesn't match the actual nesting, and that causes human confusion. Not really. All examples of this kind of confusion I have seem come from C where the problem IMO comes from the fact that people can choose to put one statement after a control structure or a block. I have programmed sometime in modula2 and this mismatch was just not a big deal in that language because such a mismatch usualy resulted in an end missing and the code not compiling, which resolves the confusion rather quickly. Now of course I can mis something. Maybe you can provide an example that would be confusing even with modula2 kind of control structures and still compile and produce a hard to trace bug. -- Antoon Pardon -- https://mail.python.org/mailman/listinfo/python-list
Re: How to add a current string into an already existing list
In article bdm7fif28r...@mid.individual.net, Gregory Ewing greg.ew...@canterbury.ac.nz wrote: Nick the Gr33k wrote: I just want a mysql column type that can be eligible to store an array of elements, a list that is, no need for having a seperate extra table for that if we can have a column that can store a list of values. Relational database systems typically don't provide any such type, because it's not the recommended way of storing that kind of data in a relational database. The recommended way is to use a secondary table, as has been pointed out. Most SQL databases allow you to store arbitrary data as an opaque value (i.e. BLOB). So, one possibility would be to just serialize your list (pickle, json, whatever) and store it that way. I've seen databases that didn't use BLOB, but just stored json in a string field. The limitation, of course, is that the data is opaque as far as the database goes; you can't do queries against it. But, if all you need to do is store the list and be able to retrieve it, it's a perfectly reasonable thing to do, and a lot more efficient than doing a join on a secondary table. Normalization is for database weenies :-) -- https://mail.python.org/mailman/listinfo/python-list
Re: First day beginner to python, add to counter after nested loop
Den lördagen den 2:e november 2013 kl. 21:19:44 UTC+1 skrev Tim Roberts: jonas.thornv...@gmail.com wrote: I certainly do not like the old bracket style it was a catastrophe, but in honesty the gui editor of python should have what i propose, a parser that indent automaticly at loops, functions and end. Many editors do that. Vim, which is what I use, certainly does. I promise you it will save millions of hours of bug searching all over world in a month. I suspect you meant dozens rather than millions... Look, both schemes have their pitfalls. With an end requirement, it's easy to have code where the indenting doesn't match the actual nesting, and that causes human confusion. Without the end requirement, it's not hard to type code where you forget to dedent. Those are just two manifestations of the exact same problem. Neither scheme is provably superior to the other. It's just a choice that a language designer has to make. I happen to like Python's choice. You'll get used to it. -- Tim Roberts, t...@probo.com Providenza Boekelheide, Inc. What does Vim stand for Voyager interstellar mission? -- https://mail.python.org/mailman/listinfo/python-list
Re: First day beginner to python, add to counter after nested loop
Den lördagen den 2:e november 2013 kl. 21:19:44 UTC+1 skrev Tim Roberts: jonas.thornv...@gmail.com wrote: I certainly do not like the old bracket style it was a catastrophe, but in honesty the gui editor of python should have what i propose, a parser that indent automaticly at loops, functions and end. Many editors do that. Vim, which is what I use, certainly does. I promise you it will save millions of hours of bug searching all over world in a month. I suspect you meant dozens rather than millions... Look, both schemes have their pitfalls. With an end requirement, it's easy to have code where the indenting doesn't match the actual nesting, and that causes human confusion. Without the end requirement, it's not hard to type code where you forget to dedent. Those are just two manifestations of the exact same problem. Neither scheme is provably superior to the other. It's just a choice that a language designer has to make. I happen to like Python's choice. You'll get used to it. -- Tim Roberts, t...@probo.com Providenza Boekelheide, Inc. Was there a VIM discussion group? -- https://mail.python.org/mailman/listinfo/python-list
Re: How to add a current string into an already existing list
On Sun, Nov 3, 2013 at 11:16 PM, Roy Smith r...@panix.com wrote: The limitation, of course, is that the data is opaque as far as the database goes; you can't do queries against it. But, if all you need to do is store the list and be able to retrieve it, it's a perfectly reasonable thing to do, and a lot more efficient than doing a join on a secondary table. Yeah, that can be an effective way to store complex data - especially if the nesting level isn't fixed. (Normalization can handle a single-level list, but it's a lot messier for handling lists of lists, for instance.) I still think that the OP's task would be best suited to a separate table (one table of visitors, another of downloads, where the Downloads table has a foreign key to Visitors), but I'm reminded of XKCD 1027: the thing standing in the way of his code is that the person coding it... is him. And of course, this is all without getting into the non-code aspects of this proposal - as have been mentioned several times, like EU regulations on retaining this level of data. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Debugging decorator
On Mon, Nov 4, 2013 at 12:20 AM, Chris Angelico ros...@gmail.com wrote: As print is now a function, you're going to need to construct a function call element instead of a special 'print' node. I don't know how to do that as I'm not an AST expert, but hopefully you can work it out from there? If you need it to be cross-version, you could probably use sys.stdout.write explicitly (not forgetting to add a newline, which print does and write - obviously - doesn't). Or just demand that from __future__ import print_function be used, which will make 2.7 like 3.3. Oh, I just noticed that the person using 2to3 wasn't the OP. My apologies, my language was aimed at the decorator's primary developer. Yasar, are you prepared to take on Python 3 support fully? If it's as simple as tweaking the Print nodes, that shouldn't be too hard (I hope). ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Debugging decorator
On Sun, Nov 3, 2013 at 9:55 PM, Jason Friedman jsf80...@gmail.com wrote: I wrote this decorator: https://gist.github.com/yasar11732/7163528 I ran it with Python 2 and thought it was neat. Most of my work is Python 3. I ran 2to3-3.3 against it and I am getting this error: $ ./simple.py Traceback (most recent call last): File ./simple.py, line 3, in module @debugger.debugging File /home/jason/python/debugger.py, line 41, in debugging new_function_body.append(make_print_node(function %s called % func.__name__)) File /home/jason/python/debugger.py, line 6, in make_print_node return ast.Print(dest=None, values=[ast.Str(s=s)], nl=True) AttributeError: 'module' object has no attribute 'Print' Comparing http://docs.python.org/2/library/ast.html#module-ast against http://docs.python.org/3.3/library/ast.html#module-ast I see that Print has indeed been removed. Ah, that'd be because 'print' is no longer a statement. Check out this function's disassembly: def hello_world(): print(Hello, world!) Python 2.7: 2 0 LOAD_CONST 1 ('Hello, world!') 3 PRINT_ITEM 4 PRINT_NEWLINE 5 LOAD_CONST 0 (None) 8 RETURN_VALUE Python 3.3: 2 0 LOAD_GLOBAL 0 (print) 3 LOAD_CONST 1 ('Hello, world!') 6 CALL_FUNCTION1 (1 positional, 0 keyword pair) 9 POP_TOP 10 LOAD_CONST 0 (None) 13 RETURN_VALUE As print is now a function, you're going to need to construct a function call element instead of a special 'print' node. I don't know how to do that as I'm not an AST expert, but hopefully you can work it out from there? If you need it to be cross-version, you could probably use sys.stdout.write explicitly (not forgetting to add a newline, which print does and write - obviously - doesn't). Or just demand that from __future__ import print_function be used, which will make 2.7 like 3.3. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Algorithm that makes maximum compression of completly diffused data.
On 11/03/2013 12:09 AM, Mark Janssen wrote: Congratulations Jonas. My kill file for this list used to have only one name, but now has 2. You have more patience than I! Jonas just made mine seven. :) Gosh, don't kill the guy. It's not an obvious thing to hardly anyone but computer scientists. It's an easy mistake to make. I don't think he's being plonked for not understanding computational theory. He's being plonked for resorting to name calling on his second post! If he was a smart computer scientist type, then engaging in a discussion about the theoretical aspects of his algorithm would have been welcomed by him, because that's what science is all about. But he failed that early on. Thanks to everyone in this part of the thread for turning this ridiculous farce into a really educational discussion on the theory of information compression. Too bad the OP has tuned out a long time ago. -- https://mail.python.org/mailman/listinfo/python-list
Re: Algorithm that makes maximum compression of completly diffused data.
On 3 November 2013 03:17, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Sat, 02 Nov 2013 14:31:09 -0700, Tim Roberts wrote: jonas.thornv...@gmail.com wrote: Well then i have news for you. Well, then, why don't you share it? Let me try to get you to understand WHY what you say is impossible. [snip reasons] But your second reason, better known as the pigeonhole principle, demonstrates that for any lossless compression method, there must be data sets that actually expand the data. It doesn't matter how cleverly you compress the data, you can't fit 20kg of potatoes in a 10kg bag, so to speak. Suppose your compression algorithm compresses a single byte into a nybble (four bits). There are 256 different input data sets (0x00, 0x01, ... 0xFF) and only 16 different outputs (0x0, 0x1, ... 0xF). There is no way for 256 pigeons to fit in 16 pigeon holes unless you put two or more pigeons in at least one hole. Ergo, if the compression algorithm is lossless, *some* data must be expanded rather than compressed. You have to be careful to make this totally rigorous, too. Note that I *can* make a compression algorithm that takes any length-n sequence and compresses all but one sequence by at least one bit, and does not ever expand the data. 00 - 01 - 0 10 - 1 11 - 00 This, obviously, is just 'cause the length is an extra piece of data, but sometimes you have to store that anyway ;). So if I have a list of N length-Y lists containing only 1s or 0s, I can genuinely compress the whole structure by N log2 Y items. -- https://mail.python.org/mailman/listinfo/python-list
Re: Algorithm that makes maximum compression of completly diffused data.
On 3 November 2013 15:34, Joshua Landau jos...@landau.ws wrote: I can genuinely compress the whole structure by N log2 Y items. By which I mean 2N items. -- https://mail.python.org/mailman/listinfo/python-list
Automation
I have one .xls file with the values of PV MV and SP, I wanna to calculate Kp Ki Kd with python from this file, can anyone give me any suggestion about how can I do this? From now, thanks. -- https://mail.python.org/mailman/listinfo/python-list
Re: Possibly better loop construct, also labels+goto important and on the fly compiler idea.
On 11/01/2013 09:52 PM, Steven D'Aprano wrote: [...] I did not declare as a fact that he had no experience, as you claim, but posed it as a question and expressed it explicitly as a subjective observation. This is a key point. Several of your other denials are true only if you are right about this. You concluded your reply to Skybuck with: Wait *until* you *start* programming... [my emphasis] The implication, that the OP does not have any programming experience, will be clear to anyone with with even mediocre English speaking ability. The semantic information conveyed to the OP is the same as the statement of fact, you have no programming experience and it is perfectly valid to claim that you told the OP that he had no programming experience. I pointed this out in nearly every email but in every one of your responses to it, you ignore that concluding sentence and mention *only* your initial questioning sentence to justify your assertion that you posed it as a question. As an aside, you shouldn't rely on that initial question sentence so much either -- just because something is framed as a question does not mean its intent is not to attack: excuse me for asking, but are you an asshole? You asked, have you *ever* done *any* programming *at all*? [my emphasis] which could be as easily taken as rhetorically laying the ground for discrediting his idea as an honest neutral question and the former interpretation is strengthened by your concluding wait until... statement. My claims of ad hominem and attack follow from the fact that you *did* tell the OP he had no programming experience, in direct contradiction to what he had stated, and with no evidence to support your claim beyond the OP's opinions on loops and goto's. Each time I have responded to you, I have given direct quotes and directly addressed the substance of your posts, which is all to do with the supposed tone of my response to the OP. Each time you have continued to misrepresent me, misquote me, and interpret my words assuming bad faith rather than good, in order to justify your idea that my post was an ad hominem attack. Including this post, where you make the false statement that: [quote] His idea was that loop tests should always or usually be done at the end of the loop. You discussed *nothing* that supported that idea. Emphasis yours. But in fact I gave the concrete example of Pascal repeat...until loops, which have the test at the end of the loop. So yet again your claims are simply wrong. That was an unfortunate example for you to chose since it directly contradicts your claims. Read that quote again. You are a programmer. You should understand logic. Please explain how acknowledging *one* useful end-of-loop construct supports the idea that /quote/ loop tests should *always or usually* be done at the end of the loop /endquote/, especially when you present it with long string of cases where testing at the bottom is *not* desirable. You did not agree with the OPs idea that the test should *always* go at the end of the loop and I represented your opinion as such. This was pointed out to you before yet you continue to claim I am misrepresenting you. This is four posts in a row now that you have wrongly represented me. I can only conclude that you think that by repeating a lie often enough, you'll convince others that it must be true and win. In my preceding post, I pointed out your practice of repeating the same discredited accusations in the the hope that repeating them enough would somehow make them true... It is amusing to see you lift my own words to use against me (although I used the word accusation and you choose to use the word lie -- a difference in our standards I guess.) I misrepresented you once, immediately acknowledged and corrected it when you pointed it out. You have continued to accuse me of misrepresenting you in *every* post you've made, while refusing to respond to my request to tell me how you think you *should* be paraphrased. Indeed you have followed a consistent policy of falsely accusing me of underhanded and disreputable practices, while at the same time, often in the same sentence, engaging copiously in exactly those same practices yourself. I will no longer play this game with you. Goodbye. *plonk* Bye. -- https://mail.python.org/mailman/listinfo/python-list
Re: Possibly better loop construct, also labels+goto important and on the fly compiler idea.
On 11/02/2013 11:17 PM, Steven D'Aprano wrote: On Sat, 02 Nov 2013 18:22:38 +, Joshua Landau wrote: [...] Sure, you in all probability didn't mean it like that but rurpy isn't uncalled for in raising the concern. Really I just want to remind you that you're both on the same side here. Thanks for the comments Joshua, but I'm afraid I cannot agree. I gave it a lot of thought and I cannot continue to give Rurpy the presumption of good faith any longer. This saddens me, but that's the way it is. Steven, presumption of good faith is typical of the disingenuous remarks that have permeated your posts in this thread. Early on, I misrepresented you by claiming you thought Skybuck's proposal was nutty rather than that you simply and reasonably disagreed with it [*1]. I also used the phrase makes no sense implying it came from you rather than from Skybuck as it had [*2]. However in pointing my mistake out [*3], you did so with remarks like: You're making that quote up that you would invent such a bare-faced falsehood that it is the *opposite* of what I actually said I don't know whether you are deliberately lying you're just such a careless reader As soon as you pointed out my mistake, I immediately acknowledged and corrected it [*4]. You continued with the outrage and attacks on my character. Bad faith in my part indeed. The nice thing about email is that there exists a record that anyone can refer to if they want to discern the truth. [*1] https://groups.google.com/d/msg/comp.lang.python/p1E0d1UGeY8/e6Xs56paZSoJ [*2] https://groups.google.com/d/msg/comp.lang.python/p1E0d1UGeY8/yDJJER6EJiIJ [*3] https://groups.google.com/d/msg/comp.lang.python/p1E0d1UGeY8/SwMcqPLMwjgJ [*4] https://groups.google.com/d/msg/comp.lang.python/p1E0d1UGeY8/7fLfIxBG4UUJ -- https://mail.python.org/mailman/listinfo/python-list
Re: Basic Python Questions - Oct. 31, 2013
In article okcdnxfaqqxze-jpnz2dnuvz_jgdn...@earthlink.com, E.D.G. edgrs...@ix.netcom.com wrote: My main, complex programs won't be run at Web sites. They will instead continue to be available as downloadable exe programs. The CGI (or whatever) programming work would involve relatively simple programs. But they would need to be able to generate charts that would be displayed on Web pages. That sounds like it is probably fairly easy to do using Python. A Perl - Gnuplot combination is also supposed to be able to do that. But so far I have not seen any good explanations for how to actually get Gnuplot to run as a callable CGI program. So other programs such as Python are being considered. One way to generate plot within a CGI program is this: 1. Write a file with gnuplot commands (e.g., 'gnuplot.cmd') that set the output device to a graphics file of some format (e.g., PNG), generate a plot, and quit gnuplot. 2. Run gnuplot and point it to the file of commands (e.g., 'gnuplot gunplot.cmd') . How this is done depends upon the CGI program language (see below). 3. Generate HTML that uses the generated graphics file as an embedded image (using the img tag). I have done this in the past, but not recently. This should work for Python (os.system(gnuplot gnuplot.cmd) or Perl (system(gnuplot gnuplot.cmd) with suitable commands to execute external programs. -- Jim Gibson -- https://mail.python.org/mailman/listinfo/python-list
Re: Basic Python Questions - Oct. 31, 2013
On Sunday, November 3, 2013 1:13:13 PM UTC+5:30, Steven D'Aprano wrote: On Sun, 03 Nov 2013 01:02:24 -0500, E.D.G. wrote: [...] Since Perl has a calculation speed limit that is probably not easy to get around, before too long another language will be selected for initially doing certain things such as performing calculations and plotting charts. And the existing Perl code might then be gradually translated into that new language. The nice things about Python are that it makes a great glue language for putting together components written in low-level languages like C and Fortran, and that there is a rich ecosystem of products for speeding it up in various ways. So when you hit the speed limits of pure Python, you have lots of options. In no particular order: * try using another Python compiler: PyPy is probably the most mature of the stand-alone optimizing compilers, and you can expect to double the speed of typical Python code, but there are others; * use numpy and scipy for vectorized mathematical routines; * re-write critical code as C or Fortran libraries; * use Pyrex (possibly unmaintained now) or Cython to write C extensions in a Python-like language; * use Psyco or Numba (JIT specialising compilers for Python); * use Theano (optimizing computer algebra system compiler); * use ctypes to call C functions directly; * use other products like Boost, Weave, and more. Yes python is really state-of-art in this respect: Every language will have some area where it sucks. Allowing for a hatch where one could jump out is helpful. Python allows more such hatches than probably any other language (that I know) https://mail.python.org/pipermail/python-list/2012-August/628090.html is a (non exhaustive) list I had made some time. On the other hand if you know you are going to be escaping out often, you may want to consider whether the 'escapee' should be your base rather than python. Which means take something like the pairwise function and code it up in python and julia -- its hardly 10 lines of code. And see what comparative performance you get. -- https://mail.python.org/mailman/listinfo/python-list
Re: Basic Python Questions - Oct. 31, 2013
On 03/11/2013 18:28, rusi wrote: Which means take something like the pairwise function and code it up in python and julia -- its hardly 10 lines of code. And see what comparative performance you get. Solely on the grounds that you've mentioned julia how about this http://blog.leahhanson.us/julia-calling-python-calling-julia.html -- Python is the second best programming language in the world. But the best has yet to be invented. Christian Tismer Mark Lawrence -- https://mail.python.org/mailman/listinfo/python-list
ANN: rom 0.22 - Redis object mapper for Python
Hey everyone, As time progresses, so does my Redis object mapper. The rom package is a Redis object mapper for Python. It sports an interface similar to Django's ORM, SQLAlchemy + Elixir, or Appengine's datastore. The changelog for recent releases can be seen below my signature. You can find the package at: https://www.github.com/josiahcarlson/rom https://pypi.python.org/pypi/rom And docs can be found at: http://pythonhosted.org/rom/ Please CC me on any replies if you have any questions or comments. Thank you, - Josiah #--- 0.22 [fixed] size estimation for intersection ordering when filtering has now been fixed, thank you to https://github.com/MickeyKim for the report and the change (should improve performance). [fixed] an issue with some types when trying to update attributes has now been fixed, thank you to https://github.com/denisvolokh for the report. [changed] improved performance for simple numeric range queries of the form Model.get_by(attr=value) or Model.get_by(attr=(min, max)) by roughly a factor of 60x or better in some cases. Thank you to https://github.com/MickeyKim for the report on poor performance. #--- 0.21 [fixed] upload for rom 0.20 was missing new columns.py, now fixed #--- 0.20 [changed] Added exception when performing .all(), .execute(), or .count() on query objects that have had no filters or attribute ordering provided. This addresses issue #12. [changed] Moved column definitions to their own module, shouldn't affect any normal uses of rom. [added] For users of Redis 2.6 and later, there is a beta Lua-enabled writing option that allows for multiple unique columns on models. In some cases, this may improve performance when writing many entities very quickly. [added] The ability to reload an entity from Redis, optionally discarding any modifications to the object itself. Check out the documentation for Model.refresh(), Session.refresh(), and Session.refresh_all() [added] Tests for the newly changed/added features. [changed] Tests no longer use flushdb() - all test models/indexes/etc. are prefixed with RomTest, and we find/delete such keys before and after any tests are run. Now anyone can reasonably run the test suite. #--- 0.19 [fixed] Thanks to a bug report by https://github.com/MickeyKim , was notified of a bug when using unique indexes, which is now fixed and has a testcase. -- https://mail.python.org/mailman/listinfo/python-list
Debugging decorator
I don't think it would be much problem. I can do that when I have spare time. Yasar. Oh, I just noticed that the person using 2to3 wasn't the OP. My apologies, my language was aimed at the decorator's primary developer. Yasar, are you prepared to take on Python 3 support fully? If it's as simple as tweaking the Print nodes, that shouldn't be too hard (I hope). ChrisA -- http://ysar.net/ -- https://mail.python.org/mailman/listinfo/python-list
Re: zero argument member functions versus properties
Ian said : Whereas in Python, an attribute access is just compiled as an attribute access no matter what the underlying implementation of that access may end up being at run-time. Really? Very nice. Have a good link handy for that? I'm compiling a codex of why py is better?. -- https://mail.python.org/mailman/listinfo/python-list
Re: Possibly better loop construct, also labels+goto important and on the fly compiler idea.
Op 03-11-13 06:17, Steven D'Aprano schreef: On Sat, 02 Nov 2013 18:22:38 +, Joshua Landau wrote: [...] Sure, you in all probability didn't mean it like that but rurpy isn't uncalled for in raising the concern. Really I just want to remind you that you're both on the same side here. Thanks for the comments Joshua, but I'm afraid I cannot agree. I gave it a lot of thought and I cannot continue to give Rurpy the presumption of good faith any longer. This saddens me, but that's the way it is. Why can't you? I think you should give Rurpy more credit. If you want this to make a welcoming community, then you should take such remarks seriously. You should realise that you are not in a good position to evaluate how your words come accross because you rely on the knowledge of your intentions. Others who don't know your intentions can reasonably get a very different understanding of what you intended. I'm trying hard to give up threads like this, where people debate the subjective tone of an email and ever more pedantic arguments about the precise wording. Even when all participants are arguing in good faith, they risk becoming quagmires which go nowhere in dozens of posts. So it seems you want this to be a welcoming community, as long as we don't propose you to change your own behaviour. As soon as it is suggested you may have to adapt your own behaviour in order to make this a welcoming community, threads where this sort of things are discusseed in, no longer appeal to you? -- https://mail.python.org/mailman/listinfo/python-list
Re: Automation
On 11/3/2013 11:19 AM, Renato Barbosa Pim Pereira wrote: I have one .xls file with the values of PV MV and SP, I wanna to calculate Kp Ki Kd with python from this file, can anyone give me any suggestion about how can I do this? You could start by explaining what those terms mean. They have no direct relationship to Python. Does this have anything to do with statistics? Quantum theory? Telephony? P = Pluto, V = Venus, S = Saturn? Help us understand - then we *might* be able to help you. -- Bob Gailer 919-636-4239 Chapel Hill NC -- https://mail.python.org/mailman/listinfo/python-list
Re: Automation
http://pastebin.com/N9dgaHTx With this program I can read a csv file with 3 columns, in one of these columns I need to read the value more high and multiply by 0.632 and with result, search in the same column by a value that aproximate with this result, and then return the vector position. -- https://mail.python.org/mailman/listinfo/python-list
Re: Automation
On 03/11/2013 21:22, bob gailer wrote: On 11/3/2013 11:19 AM, Renato Barbosa Pim Pereira wrote: I have one .xls file with the values of PV MV and SP, I wanna to calculate Kp Ki Kd with python from this file, can anyone give me any suggestion about how can I do this? You could start by explaining what those terms mean. They have no direct relationship to Python. Does this have anything to do with statistics? Quantum theory? Telephony? P = Pluto, V = Venus, S = Saturn? Help us understand - then we *might* be able to help you. According to http://www.acronymfinder.com there are only 85 meanings for PV, 75 for MV and a mere 290 for SP so simply take your pick :) -- Python is the second best programming language in the world. But the best has yet to be invented. Christian Tismer Mark Lawrence -- https://mail.python.org/mailman/listinfo/python-list
Re: Possibly better loop construct, also labels+goto important and on the fly compiler idea.
Antoon Pardon antoon.par...@rece.vub.ac.be writes: Op 03-11-13 06:17, Steven D'Aprano schreef: I'm trying hard to give up threads like this, where people debate the subjective tone of an email and ever more pedantic arguments about the precise wording. Even when all participants are arguing in good faith, they risk becoming quagmires which go nowhere in dozens of posts. So it seems you want this to be a welcoming community, as long as we don't propose you to change your own behaviour. We aim to be a community that always welcomes diversity of people. This does not entail always welcoming bad behaviour. Steven is aiming to change his behaviour to make the community more welcoming of people: he is aiming to cease contributing to threads where the bad behaviour is an interminable discussion of tone and pedantry. This is, as I see it, wholly compatible with making the community more welcoming to people, by reducing the volume of such threads. -- \ Eccles: “I just saw the Earth through the clouds!” Lew: “Did | `\ it look round?” Eccles: “Yes, but I don't think it saw me.” | _o__)—The Goon Show, _Wings Over Dagenham_ | Ben Finney -- https://mail.python.org/mailman/listinfo/python-list
Re: Automation
On Sun, 3 Nov 2013 14:19:48 -0200 Renato Barbosa Pim Pereira wrote: I have one .xls file with the values of PV MV and SP, I wanna to calculate Kp Ki Kd with python from this file, can anyone give me any suggestion about how can I do this? From now, thanks. Did you looked at http://www.python-excel.org/ ? May this can help you solving your problem. Since you are not explaining what you want to do I can really not help you more. And I don't use Excel too. And maybe ask the people over at http://groups.google.com/group/python-excel if they can help you. Regards, Johannes -- https://mail.python.org/mailman/listinfo/python-list
Re: Automation
On 11/3/2013 4:48 PM, renato.barbosa.pim.pere...@gmail.com wrote: http://pastebin.com/N9dgaHTx With this program I can read a csv file with 3 columns, in one of these columns I need to read the value more high and multiply by 0.632 and with result, search in the same column by a value that aproximate with this result, and then return the vector position. Oh ... will you please explain in good English and a lot more detail. I can only begin to guess from that what you want. Guessing wastes all our time. -- Bob Gailer 919-636-4239 Chapel Hill NC -- https://mail.python.org/mailman/listinfo/python-list
Re: Slicing with negative strides
On 29 Oct 2013 05:22:00 GMT Steven D'Aprano st...@pearwood.info wrote: Does anyone here use slices (or range/xrange) with negative strides other than -1? I have used negative strides for comparing discrete sequences e. g. for turbulence analysis, and I hope that my code will still run in Python 4. Martin -- https://mail.python.org/mailman/listinfo/python-list
Re: Basic Python Questions - Oct. 31, 2013
On 2013-11-03, Jim Gibson jimsgib...@gmail.com wrote: In article okcdnxfaqqxze-jpnz2dnuvz_jgdn...@earthlink.com, E.D.G. edgrs...@ix.netcom.com wrote: My main, complex programs won't be run at Web sites. They will instead continue to be available as downloadable exe programs. The CGI (or whatever) programming work would involve relatively simple programs. But they would need to be able to generate charts that would be displayed on Web pages. That sounds like it is probably fairly easy to do using Python. A Perl - Gnuplot combination is also supposed to be able to do that. But so far I have not seen any good explanations for how to actually get Gnuplot to run as a callable CGI program. So other programs such as Python are being considered. One way to generate plot within a CGI program is this: 1. Write a file with gnuplot commands (e.g., 'gnuplot.cmd') that set the output device to a graphics file of some format (e.g., PNG), generate a plot, and quit gnuplot. Or you can use the pygnuplot module which handles much of that for y0ou. http://pygnuplot.sourceforge.net/ -- Grant -- https://mail.python.org/mailman/listinfo/python-list
Re: Automation
On Sun, 03 Nov 2013 14:19:48 -0200, Renato Barbosa Pim Pereira wrote: I have one .xls file with the values of PV MV and SP, I wanna to calculate Kp Ki Kd with python from this file, can anyone give me any suggestion about how can I do this? From now, thanks. Why use Python? Why not simply write excel to do the calculations? Assuming PV, MV and SP are in columns, you simply need to write your equations for Kp, Ki and Kd so that they reference the relevant columns, and then past them down the whole spreadsheet. Seems to me like you're using a sledgehammer to shell a peanut. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list
Re: Automation
On 03/11/2013 21:53, Mark Lawrence wrote: On 03/11/2013 21:22, bob gailer wrote: On 11/3/2013 11:19 AM, Renato Barbosa Pim Pereira wrote: I have one .xls file with the values of PV MV and SP, I wanna to calculate Kp Ki Kd with python from this file, can anyone give me any suggestion about how can I do this? You could start by explaining what those terms mean. They have no direct relationship to Python. Does this have anything to do with statistics? Quantum theory? Telephony? P = Pluto, V = Venus, S = Saturn? Help us understand - then we *might* be able to help you. According to http://www.acronymfinder.com there are only 85 meanings for PV, 75 for MV and a mere 290 for SP so simply take your pick :) If you put all PV MV SP into Google you get results about Process Dynamics/Control. Does that help? :-) -- https://mail.python.org/mailman/listinfo/python-list
Problem installing matplotlib 1.3.1 with Python 2.7.6 and 3.3.3 (release candidate 1)
Hello, I tried to install matplotlib 1.3.1 on the release candidates of Python 2.7.6 and 3.3.3. I am on Mac OS X 10.6.8. Although the installation gave no problems, there is a problem with Tcl/Tk. The new Pythons have their own embedded Tcl/Tk, but when installing matplotlib it links to the Frameworks version of Tcl and TK, not to the embedded version. This causes confusion when importing matplotlib.pyplot: objc[70648]: Class TKApplication is implemented in both /Library/Frameworks/Python.framework/Versions/2.7/lib/libtk8.5.dylib and /Library/Frameworks/Tk.framework/Versions/8.5/Tk. One of the two will be used. Which one is undefined. objc[70648]: Class TKMenu is implemented in both /Library/Frameworks/Python.framework/Versions/2.7/lib/libtk8.5.dylib and /Library/Frameworks/Tk.framework/Versions/8.5/Tk. One of the two will be used. Which one is undefined. objc[70648]: Class TKContentView is implemented in both /Library/Frameworks/Python.framework/Versions/2.7/lib/libtk8.5.dylib and /Library/Frameworks/Tk.framework/Versions/8.5/Tk. One of the two will be used. Which one is undefined. objc[70648]: Class TKWindow is implemented in both /Library/Frameworks/Python.framework/Versions/2.7/lib/libtk8.5.dylib and /Library/Frameworks/Tk.framework/Versions/8.5/Tk. One of the two will be used. Which one is undefined. And then later it gives a lot of error messages. So I think it should be linked to the embedded version. For this the matplotlib setupext.py should be adapted to find out if there is an embedded Tcl/Tk in the Python installation and set the link parameters accordingly. However, the installed Python versions (from the DMG's) do not contain the Tcl/Tk header files, only the shared library and the tcl files. So I thing the distributed Python should also include the Tcl/Tk header files. -- Piet van Oostrum p...@vanoostrum.org WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list
RE: Parsing multiple lines from text file using regex
This is an alternative solution someone else posted on this list for a similar problem I had: #!/usr/bin/python3 from itertools import groupby def get_lines_from_file(file_name): with open(file_name) as reader: for line in reader.readlines(): yield(line.strip()) counter = 0 def key_func(x): if x.strip().startswith(banner) and x.strip().endswith(banner text delimiter): global counter counter += 1 return counter for key, group in groupby(get_lines_from_file(my_data), key_func): print(list(group)[1:-1]) Thanks Jason, banner = re.compile(r'banner\s+(\w+)\s+(.+)(.*?)\2', re.DOTALL).findall(lines) worked nicely to get what I needed: outfile.write(Banner type: %s Banner Delimiter: %s\n % (banner[0][0], banner[0][1])) outfile.write(Banner Text:\n) outfile.write(banner[0][2]) Probably not the prettiest, most concise code, but it gets the job done. Thanks again, Marc -- https://mail.python.org/mailman/listinfo/python-list
Re: Problem installing matplotlib 1.3.1 with Python 2.7.6 and 3.3.3 (release candidate 1)
In article 21110.62791.44734.656...@cochabamba.vanoostrum.org, Piet van Oostrum p...@vanoostrum.org wrote: I tried to install matplotlib 1.3.1 on the release candidates of Python 2.7.6 and 3.3.3. [...] Please open an issue on the Python bug tracker for the Python component of this. http://bugs.python.org -- Ned Deily, n...@acm.org -- https://mail.python.org/mailman/listinfo/python-list
Python Practice Problems
Hi, who has some problems to practice using Python? Thx a lot! -- https://mail.python.org/mailman/listinfo/python-list
Re: zero argument member functions versus properties
On Sun, Nov 3, 2013 at 2:23 PM, Peter Cacioppi peter.cacio...@gmail.com wrote: Ian said : Whereas in Python, an attribute access is just compiled as an attribute access no matter what the underlying implementation of that access may end up being at run-time. Really? Very nice. Have a good link handy for that? I'm compiling a codex of why py is better?. Sorry, no, but this fact should be apparent as a consequence of Python's dynamicism. Since the compiler generally can't predict what the types of objects will be, the bytecode that it generates can't depend on those types. -- https://mail.python.org/mailman/listinfo/python-list
Re: Algorithm that makes maximum compression of completly diffused data.
Note that I *can* make a compression algorithm that takes any length-n sequence and compresses all but one sequence by at least one bit, and does not ever expand the data. 00 - 01 - 0 10 - 1 11 - 00 This, obviously, is just 'cause the length is an extra piece of data, but sometimes you have to store that anyway ;). And how many bits will you use to store the length? So if I have a list of N length-Y lists containing only 1s or 0s, I can genuinely compress the whole structure by N log2 Y items. But you cheated by using a piece of information from outside the system: length. A generic compression algorithm doesn't have this information beforehand. -- MarkJ Tacoma, Washington -- https://mail.python.org/mailman/listinfo/python-list
Re: Automation
Let's remember that it is the job of the OP to explain his problem so we can offer solutions. -- Bob Gailer 919-636-4239 Chapel Hill NC -- https://mail.python.org/mailman/listinfo/python-list
Re: Basic Python Questions - Oct. 31, 2013
On Monday, November 4, 2013 12:28:24 AM UTC+5:30, Mark Lawrence wrote: On 03/11/2013 18:28, rusi wrote: Which means take something like the pairwise function and code it up in python and julia -- its hardly 10 lines of code. And see what comparative performance you get. Solely on the grounds that you've mentioned julia how about this http://blog.leahhanson.us/julia-calling-python-calling-julia.html Good stuff -- thanks -- https://mail.python.org/mailman/listinfo/python-list
Re: Automation
On Sunday, November 3, 2013 9:49:48 PM UTC+5:30, Renato Barbosa Pim Pereira wrote: I have one .xls file with the values of PV MV and SP, I wanna to calculate Kp Ki Kd with python from this file, can anyone give me any suggestion about how can I do this? From now, thanks. You need something like this? http://stackoverflow.com/questions/5425210/shortcut-to-apply-a-formula-to-an-entire-column-in-excel -- https://mail.python.org/mailman/listinfo/python-list
Re: Automation
On Sun, Nov 3, 2013 at 8:19 AM, Renato Barbosa Pim Pereira renato.barbosa.pim.pere...@gmail.com wrote: I have one .xls file with the values of PV MV and SP, I wanna to calculate Kp Ki Kd with python from this file, can anyone give me any suggestion about how can I do this? From now, thanks. You're being rather vague, so my answer is vague too. I won't attempt to deal with the formulas for your conversions - apparently that's your business. But for dealing with xls files, I recommend saving to and reading from .csv files; Python deals great with these. If you're not concerned about getting (further) locked into a dying, binary-only platform, you could use xlrd and xlwt though. It looks like xlrd runs on 2.x and 3.x, while xlwt is still 2.x only - that's another reason to go with csv, which works well with 2.x and 3.x for reading and writing. -- https://mail.python.org/mailman/listinfo/python-list
Re: Python Practice Problems
On 11/03/2013 06:06 PM, yungwong@gmail.com wrote: Hi, who has some problems to practice using Python? Thx a lot! http://projecteuler.net/ is always a good bet -- https://mail.python.org/mailman/listinfo/python-list
Re: Problem installing matplotlib 1.3.1 with Python 2.7.6 and 3.3.3 (release candidate 1)
Am 04.11.2013 01:59, schrieb Ned Deily: In article 21110.62791.44734.656...@cochabamba.vanoostrum.org, Piet van Oostrum p...@vanoostrum.org wrote: I tried to install matplotlib 1.3.1 on the release candidates of Python 2.7.6 and 3.3.3. [...] Please open an issue on the Python bug tracker for the Python component of this. http://bugs.python.org And please mark as release blocker, I think this should go into 3.3.3rc2. Georg -- https://mail.python.org/mailman/listinfo/python-list
[issue19439] Build _testembed on Windows
Zachary Ware added the comment: This patch's changes to test_capi seem to work for Windows and keeps at least Gentoo and FreeBSD 10 happy. -- stage: - patch review Added file: http://bugs.python.org/file32471/issue19439.v2.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19439 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19482] _pickle build warnings on Fedora 19
New submission from Nick Coghlan: Currently getting build warnings from _pickle.c: == building '_pickle' extension gcc -pthread -fPIC -Wno-unused-result -Werror=declaration-after-statement -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I./Include -I. -IInclude -I/usr/local/include -I/home/ncoghlan/devel/py3k/Include -I/home/ncoghlan/devel/py3k -c /home/ncoghlan/devel/py3k/Modules/_pickle.c -o build/temp.linux-x86_64-3.4/home/ncoghlan/devel/py3k/Modules/_pickle.o /home/ncoghlan/devel/py3k/Modules/_pickle.c: In function ‘load_counted_long’: /home/ncoghlan/devel/py3k/Modules/_pickle.c:4143:15: warning: ‘pdata’ may be used uninitialized in this function [-Wmaybe-uninitialized] value = _PyLong_FromByteArray((unsigned char *)pdata, (size_t)size, ^ /home/ncoghlan/devel/py3k/Modules/_pickle.c: In function ‘load’: /home/ncoghlan/devel/py3k/Modules/_pickle.c:5330:25: warning: ‘s’ may be used uninitialized in this function [-Wmaybe-uninitialized] i = (unsigned char)s[0]; ^ /home/ncoghlan/devel/py3k/Modules/_pickle.c:5324:11: note: ‘s’ was declared here char *s; ^ /home/ncoghlan/devel/py3k/Modules/_pickle.c:4995:30: warning: ‘s’ may be used uninitialized in this function [-Wmaybe-uninitialized] idx = Py_CHARMASK(s[0]); ^ /home/ncoghlan/devel/py3k/Modules/_pickle.c:4986:11: note: ‘s’ was declared here char *s; ^ /home/ncoghlan/devel/py3k/Modules/_pickle.c:4005:20: warning: ‘s’ may be used uninitialized in this function [-Wmaybe-uninitialized] x |= (size_t) s[3] 24; ^ /home/ncoghlan/devel/py3k/Modules/_pickle.c:4858:11: note: ‘s’ was declared here char *s; ^ gcc -pthread -shared build/temp.linux-x86_64-3.4/home/ncoghlan/devel/py3k/Modules/_pickle.o -L/usr/local/lib -o build/lib.linux-x86_64-3.4/_pickle.cpython-34m.so == -- components: Extension Modules messages: 201997 nosy: ncoghlan priority: normal severity: normal stage: needs patch status: open title: _pickle build warnings on Fedora 19 type: compile error versions: Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19482 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4331] Add functools.partialmethod
Roundup Robot added the comment: New changeset 46d3c5539981 by Nick Coghlan in branch 'default': Issue #4331: Added functools.partialmethod http://hg.python.org/cpython/rev/46d3c5539981 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4331 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4331] Add functools.partialmethod
Changes by Nick Coghlan ncogh...@gmail.com: -- resolution: - fixed stage: commit review - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4331 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19481] IDLE hangs while printing instance of Unicode subclass
Changes by Serhiy Storchaka storch...@gmail.com: -- nosy: +kbk, roger.serwy, serhiy.storchaka, terry.reedy type: - behavior ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19481 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19439] Build _testembed on Windows
Nick Coghlan added the comment: I checked that test_capi still passed on Fedora as well. Only tweak I made before committing was to ensure that the read end of the test pipe used to determine the default pipe encoding was also closed. -- resolution: fixed - stage: committed/rejected - patch review status: closed - open ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19439 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19439] Build _testembed on Windows
Changes by Nick Coghlan ncogh...@gmail.com: -- resolution: - fixed stage: patch review - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19439 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19439] Build _testembed on Windows
Roundup Robot added the comment: New changeset c8c6c007ade3 by Nick Coghlan in branch 'default': Close #19439: execute embedding tests on Windows http://hg.python.org/cpython/rev/c8c6c007ade3 -- nosy: +python-dev resolution: - fixed stage: patch review - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19439 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19403] Make contextlib.redirect_stdout reentrant
Roundup Robot added the comment: New changeset 87d49e2cdd34 by Nick Coghlan in branch 'default': Close #19403: make contextlib.redirect_stdout reentrant http://hg.python.org/cpython/rev/87d49e2cdd34 -- nosy: +python-dev resolution: - fixed stage: - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19403 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16129] No good way to set 'PYTHONIOENCODING' when embedding python.
Nick Coghlan added the comment: Bastien, did you get a chance to try embedding Python 3.4a4 in Blender yet? If that works for you, we can mark this one as closed. -- status: pending - open ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16129 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19481] IDLE hangs while printing instance of Unicode subclass
Terry J. Reedy added the comment: Win 7, console 2.7.5+, 32 bit, compiled Aug 24, does not have the problem. Idle started with 'import idlelib.idle' does, but only for 'print foo', as Tim reported. When I close the hung process with [X], there is no error message in the console. Installed 64bit 2.7.5 fails with 'print foo' also. I actually used F and f instead of Foo and foo, so it is not name specific. A subclass of str works fine. Current 3.4a4 Idle works fine. The SO OP also reported that there is no problem is the class is imported from another file. We need a test on something other than Windows, preferably both mac and linux. -- nosy: +ned.deily ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19481 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17762] platform.linux_distribution() should honor /etc/os-release
Changes by Andrei Dorian Duma andrei.duma.dor...@gmail.com: -- nosy: +haypo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17762 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19481] IDLE hangs while printing instance of Unicode subclass
Ned Deily added the comment: It's reproducible on OS X as well with a 32-bit Python 2.7.5 and a 64-bit Python 2.7.6rc1. However, the example works OK if I start IDLE with no subprocess (-n). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19481 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19481] IDLE hangs while printing instance of Unicode subclass
Serhiy Storchaka added the comment: This patch fixes symptoms. -- keywords: +patch stage: - patch review Added file: http://bugs.python.org/file32472/idle_print_unicode_subclass.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19481 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19085] Add tkinter basic options tests
Ned Deily added the comment: With Cocoa Tk 8.5.15 or Cocoa Tk 8.6.1 on OS X 10.8.5, test_widgets.ButtonTest crashes Tk: test_image (tkinter.test.test_tkinter.test_widgets.ButtonTest) ... 2013-11-03 01:52:53.498 pytest_10.8[82465:f07] *** Assertion failure in -[NSBitmapImageRep initWithCGImage:], /SourceCache/AppKit/AppKit-1187.40/AppKit.subproj/NSBitmapImageRep.m:1242 2013-11-03 01:52:53.499 pytest_10.8[82465:f07] An uncaught exception was raised 2013-11-03 01:52:53.499 pytest_10.8[82465:f07] Invalid parameter not satisfying: cgImage != NULL 2013-11-03 01:52:53.502 pytest_10.8[82465:f07] ( 0 CoreFoundation 0x965eae8b __raiseError + 219 1 libobjc.A.dylib 0x956d152e objc_exception_throw + 230 2 CoreFoundation 0x9654a698 +[NSException raise:format:arguments:] + 136 3 Foundation 0x966a5364 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 116 4 AppKit 0x98a34525 -[NSBitmapImageRep initWithCGImage:] + 145 5 Tk 0x00725a48 CreateNSImageWithPixmap + 151 6 Tk 0x00725b1c TkMacOSXGetNSImageWithTkImage + 149 7 Tk 0x0071eb2f TkpComputeButtonGeometry + 2550 8 Tk 0x0069849d TkButtonWorldChanged + 470 9 Tk 0x00698e99 ConfigureButton + 1981 10 Tk 0x0069980f ButtonWidgetObjCmd + 440 11 Tcl 0x00579c2f TclEvalObjvInternal + 770 12 Tcl 0x0057ac1a Tcl_EvalObjv + 72 13 _tkinter.so 0x0055db81 Tkapp_Call + 673 [...] With Carbon Tk 8.4.20 on OS X 10.8.5, two test_insertborderwidth failures: == FAIL: test_insertborderwidth (tkinter.test.test_tkinter.test_widgets.EntryTest) -- Traceback (most recent call last): File /py/dev/3x/root/fwd32/Library/Frameworks/pytest_10.8.framework/Versions/3.4/lib/python3.4/tkinter/test/test_tkinter/test_widgets.py, line 327, in test_insertborderwidth self.checkPixelsParam(widget, 'insertborderwidth', 0, 1.3, -2) File /py/dev/3x/root/fwd32/Library/Frameworks/pytest_10.8.framework/Versions/3.4/lib/python3.4/tkinter/test/widget_tests.py, line 158, in checkPixelsParam conv=conv1, **kwargs) File /py/dev/3x/root/fwd32/Library/Frameworks/pytest_10.8.framework/Versions/3.4/lib/python3.4/tkinter/test/widget_tests.py, line 48, in checkParam self.assertEqual2(widget[name], expected, eq=eq) File /py/dev/3x/root/fwd32/Library/Frameworks/pytest_10.8.framework/Versions/3.4/lib/python3.4/tkinter/test/widget_tests.py, line 32, in assertEqual2 self.assertEqual(actual, expected, msg) AssertionError: 0 != 1 == FAIL: test_insertborderwidth (tkinter.test.test_tkinter.test_widgets.SpinboxTest) -- Traceback (most recent call last): File /py/dev/3x/root/fwd32/Library/Frameworks/pytest_10.8.framework/Versions/3.4/lib/python3.4/tkinter/test/test_tkinter/test_widgets.py, line 327, in test_insertborderwidth self.checkPixelsParam(widget, 'insertborderwidth', 0, 1.3, -2) File /py/dev/3x/root/fwd32/Library/Frameworks/pytest_10.8.framework/Versions/3.4/lib/python3.4/tkinter/test/widget_tests.py, line 158, in checkPixelsParam conv=conv1, **kwargs) File /py/dev/3x/root/fwd32/Library/Frameworks/pytest_10.8.framework/Versions/3.4/lib/python3.4/tkinter/test/widget_tests.py, line 48, in checkParam self.assertEqual2(widget[name], expected, eq=eq) File /py/dev/3x/root/fwd32/Library/Frameworks/pytest_10.8.framework/Versions/3.4/lib/python3.4/tkinter/test/widget_tests.py, line 32, in assertEqual2 self.assertEqual(actual, expected, msg) AssertionError: 0 != 1 -- Ran 536 tests in 1.149s FAILED (failures=2, skipped=10) -- priority: high - critical ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19085 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16129] No good way to set 'PYTHONIOENCODING' when embedding python.
Bastien Montagne added the comment: Wow… Good thing you remind me that. Just tested it here (linux with ASCII terminal), works perfectly. Thanks again for all the integration work, Nick! -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16129 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19320] Tkinter tests ran with wantobjects is false
Serhiy Storchaka added the comment: Failed buildbots: http://buildbot.python.org/all/builders/x86%20Windows%20Server%202003%20%5BSB%5D%202.7 http://buildbot.python.org/all/builders/AMD64%20Windows%20Server%202008%20%5BSB%5D%202.7 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19320 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19085] Add tkinter basic options tests
Serhiy Storchaka added the comment: Yes, I know. Here is a list of broken buildbots: http://buildbot.python.org/all/builders/x86%20FreeBSD%206.4%203.x http://buildbot.python.org/all/builders/x86%20FreeBSD%207.2%203.x http://buildbot.python.org/all/builders/x86%20FreeBSD%206.4%203.3 http://buildbot.python.org/all/builders/x86%20Tiger%203.3 http://buildbot.python.org/all/builders/x86%20Windows7%202.7 http://buildbot.python.org/all/builders/x86%20XP-4%202.7 http://buildbot.python.org/all/builders/x86%20FreeBSD%206.4%202.7 http://buildbot.python.org/all/builders/x86%20FreeBSD%207.2%202.7 On Tiger only two tests failed, on other buildbots multiple tests failed and symptoms look as differences between 8.5 and 8.4 or 8.5 (Tk version is wrongly detected?). I'm working on this. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19085 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18345] logging: file creation options with FileHandler and friends
Claudiu.Popa added the comment: Hello. Patch attached. -- keywords: +patch nosy: +Claudiu.Popa Added file: http://bugs.python.org/file32473/logging.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18345 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19483] Pure-Python ElementTree classes no longer available since 3.3
New submission from Brecht Machiels: With Python 3.2, I subclassed ElementTree.XMLParser to set ExternalEntityRefHandler on the XMLParser's (expat) 'parser' member. I understand the 'parser' member is not part of the public API, but this was the only way to customize the parser without having to write a parser from scratch. With 3.3, cElementTree replaces the Python implementation by default. Its XMLParser class has no accessible 'parser' member to configure. Unfortunately, there does not seem to be a way to use the pure-Python XMLParser, which would still allow for customization of the parser. Why is the Python version still in the library if it can't be accessed? Only for platforms where the C extension is not available? I see two possible solutions: 1) Have XMLParser (both the C and Python versions) accept an optional parser argument, so that a custom parser can be passed in. 2) Make the Python version of ElementTree available again. My other option is to copy the Python XMLParser version into my project. I would like to avoid this, as this would duplicate a lot of perfectly good code. Perhaps there are other solutions? -- components: XML messages: 202011 nosy: brechtm, eli.bendersky, scoder priority: normal severity: normal status: open title: Pure-Python ElementTree classes no longer available since 3.3 type: behavior versions: Python 3.3, Python 3.4, Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19483 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18345] logging: file creation options with FileHandler and friends
Claudiu.Popa added the comment: Added documentation and the chown parameter for the friends of FileHandler. Should tests be added for those classes as well or is it enough to test FileHandler? -- Added file: http://bugs.python.org/file32474/logging.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18345 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18345] logging: file creation options with FileHandler and friends
Changes by Claudiu.Popa pcmantic...@gmail.com: Added file: http://bugs.python.org/file32475/logging.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18345 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19424] _warnings: patch to avoid conversions from/to UTF-8
Vajrasky Kok added the comment: Py_ssize_t is signed long. size_it is unsigned long. In this case, I suppose we should avoid unsigned as much as possible in comparison with signed. So I think Zachary's patch is reasonable. What do you think, Victor? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19424 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19464] Remove warnings from Windows buildbot clean script
Roundup Robot added the comment: New changeset dbff708e393f by Tim Golden in branch '3.3': Issue #19464 Suppress compiler warnings during clean. Patch by Zachary Ware. http://hg.python.org/cpython/rev/dbff708e393f New changeset 6e592d972b86 by Tim Golden in branch 'default': Issue #19464 Null merge with 3.3 http://hg.python.org/cpython/rev/6e592d972b86 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19464 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19464] Remove warnings from Windows buildbot clean script
Tim Golden added the comment: Applied to 3.3 3.4. Thanks for the patch. -- resolution: - fixed stage: - committed/rejected ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19464 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19464] Remove warnings from Windows buildbot clean script
Changes by Tim Golden m...@timgolden.me.uk: -- status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19464 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6160] Tkinter.Spinbox: fix bbox method
Roundup Robot added the comment: New changeset 91453ba40b30 by Serhiy Storchaka in branch '2.7': Issue #6160: The bbox() method of Tkinter.Spinbox now returns a tuple of http://hg.python.org/cpython/rev/91453ba40b30 New changeset 5bdbf2258563 by Serhiy Storchaka in branch '3.3': Issue #6160: The bbox() method of tkinter.Spinbox now returns a tuple of http://hg.python.org/cpython/rev/5bdbf2258563 New changeset 75d8b9136fa6 by Serhiy Storchaka in branch 'default': Issue #6160: The bbox() method of tkinter.Spinbox now returns a tuple of http://hg.python.org/cpython/rev/75d8b9136fa6 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6160 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16129] No good way to set 'PYTHONIOENCODING' when embedding python.
Nick Coghlan added the comment: Excellent! Zachary Ware got the embedding tests running and passing on Windows in issue 19439 (previously they were only executed on *nix systems), so Python 3.4 should resolve this problem on all platforms. -- status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16129 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6157] Tkinter.Text: changes for bbox, debug, and edit methods.
Roundup Robot added the comment: New changeset b3178d03871b by Serhiy Storchaka in branch '2.7': Issue #6157: Fixed Tkinter.Text.debug(). Original patch by Guilherme Polo. http://hg.python.org/cpython/rev/b3178d03871b New changeset 3f5e35b766ac by Serhiy Storchaka in branch '3.3': Issue #6157: Fixed tkinter.Text.debug(). Original patch by Guilherme Polo. http://hg.python.org/cpython/rev/3f5e35b766ac New changeset c40b573c9f7a by Serhiy Storchaka in branch 'default': Issue #6157: Fixed tkinter.Text.debug(). tkinter.Text.bbox() now raises http://hg.python.org/cpython/rev/c40b573c9f7a -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6157 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12029] Catching virtual subclasses in except clauses
Nick Coghlan added the comment: A point on the safety/correctness front: I remembered we already run arbitrary code at roughly this point in the eval loop, as we have to invoke __iter__ to get the exceptions to check when an iterable is used in except clause. That means allowing the subclass check hooks to run here isn't as radical a change as I first thought. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12029 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17400] ipaddress should make it easy to identify rfc6598 addresses
Nick Coghlan added the comment: Just updating the issue state to reflect the fact Peter committed this a while ago. -- resolution: - fixed stage: - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17400 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6167] Tkinter.Scrollbar: the activate method needs to return a value, and set should take only two args
Changes by Serhiy Storchaka storch...@gmail.com: -- nosy: +terry.reedy ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6167 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6159] Tkinter.PanedWindow: docstring fixes, change in paneconfigure and removed some returns
Changes by Serhiy Storchaka storch...@gmail.com: Added file: http://bugs.python.org/file32476/PanedWindow_docstring_and_return_fixes_2.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6159 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com