Re: How to import all things defined the files in a module directory in __init__.py?
On Saturday, September 24, 2016 at 2:11:09 PM UTC+12, Chris Angelico wrote: > It's a large and complex module, and about at the boundary of being > broken up a bit. Splitting it up would make it slower to load. -- https://mail.python.org/mailman/listinfo/python-list
Re: pypy on windows much slower than linux/mac when using complex number type?
Am 23.09.16 um 21:50 schrieb Irmen de Jong: The problem boiled down to a performance issue in window's 32 bits implementation of the hypot() function (which abs(z) uses when z is a complex number type). The 64 bits windows crt lib version is much faster (on par with what is to be expected from the linux or osx version), but unfortunately there's no 64 bits pypy implementation for windows. Replacing abs(z) by sqrt(r*r+i*i) avoids the problem and is even faster still. Interesting! Now beware that a "real" hypot function does approximately the following: def myhypot(r, i): if abs(r)>abs(i): c = i/r return abs(r)*sqrt(1+c*c) else: if i==0: return 0.0 else: c=r/i return abs(i)*sqrt(1+c*c) it can well be, that the old 32bit MSVCRT does simply that, which requires some floating point ops, whereas the more modern 64bit lib uses hand-tuned SSE to perform the equivalent. Just for fun, you could try this hypot to see how it performs. Christian -- https://mail.python.org/mailman/listinfo/python-list
Re: PyThreadState_Get
Bharadwaj Srivatsa writes: > Which ever project I am trying to install using python setup.py install > command, i am getting the following error.. > > python -mtrace --trace setup.py install > Fatal Python error: PyThreadState_Get: no current thread > ABORT instruction (core dumped) > > How to get rid of this error and whats the cause for this What happens when you omit "-mtrace --trace"? -- https://mail.python.org/mailman/listinfo/python-list
Re: How to import all things defined the files in a module directory in __init__.py?
On Sat, 24 Sep 2016 04:59 pm, Lawrence D’Oliveiro wrote: > On Saturday, September 24, 2016 at 2:11:09 PM UTC+12, Chris Angelico > wrote: >> It's a large and complex module, and about at the boundary of being >> broken up a bit. > > Splitting it up would make it slower to load. Would it? You've bench marked it and found that it makes a significant difference? In any case, you're missing the point. Size carries its own cost to the human reader, never mind whether or not the interpreter can deal with it: https://en.wikipedia.org/wiki/The_Magical_Number_Seven,_Plus_or_Minus_Two The decimal module is approaching a size where it is no longer comfortable to read or edit: - 6450 lines in the source file (include comments, blanks, etc); - 27 top-level functions; - 54 global variables/constants; - 19 classes, which isn't too bad on its own, but: - one of those classes has 83 methods; - and another has 127 methods; - the Decimal class itself is 3311 lines alone; excluding blanks, comments and docstrings, it is 2013 SLOC. This a partly a matter of taste, and to my taste, the decimal module is about as big as I would like to see a module before I split it into submodules purely on the basis of size. -- Steve “Cheer up,” they said, “things could be worse.” So I cheered up, and sure enough, things got worse. -- https://mail.python.org/mailman/listinfo/python-list
Re: How to import all things defined the files in a module directory in __init__.py?
> Splitting it up would make it slower to load. It's usually the opposite. When packages are split up, you only have to load the specific portions you need. Putting it all in a single module forces you to always load everything. On Fri, Sep 23, 2016 at 11:59 PM, Lawrence D’Oliveiro < lawrenced...@gmail.com> wrote: > On Saturday, September 24, 2016 at 2:11:09 PM UTC+12, Chris Angelico wrote: > > It's a large and complex module, and about at the boundary of being > > broken up a bit. > > Splitting it up would make it slower to load. > -- > https://mail.python.org/mailman/listinfo/python-list > -- https://mail.python.org/mailman/listinfo/python-list
Re: How to import all things defined the files in a module directory in __init__.py?
On Sat, Sep 24, 2016 at 9:32 PM, Brendan Abel <007bren...@gmail.com> wrote: >> Splitting it up would make it slower to load. > > It's usually the opposite. When packages are split up, you only have to > load the specific portions you need. Putting it all in a single module > forces you to always load everything. This can be true ONLY if they're sufficiently separate that most users can pick and choose. If the bulk of users are going to need every piece, the split will slow it down significantly. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Looking for tips and gotchas for working with Python 3.5 zipapp feature
Hi Paul, > Just one further note, which may or may not be obvious. If your application > uses external dependencies from PyPI, you can bundle them with your > application using pip's --target option ... Cool stuff! To your question: None of what you've shared has been obvious to me :) Packaging and distributing Python scripts as zipped archives is such a powerful feature I'm surprised that there hasn't been more written on this topic. Thank you for sharing these tips with me and the rest of the Python list community !! Malcolm -- https://mail.python.org/mailman/listinfo/python-list
ANN: asciimatics v1.7.0
I am very pleased to announce asciimatics v1.7.0! This is a major update since the last announced version of the package. ## What is asciimatics? Asciimatics is a package to help people create full-screen text UIs (from interactive forms to complex text animations) on Linux, Windows and OSX. It supports python 2 & 3 and is licensed under the Apache Software Foundation License 2.0. ## What’s new? This release includes a `widgets` sub-package to create text User Interfaces, complete with the standard basic set of widgets you would expect for creating forms – e.g. text boxes, check boxes, buttons, etc. Despite its name, asciimatics now fully supports Unicode in utf-8 environments, allowing for non-ASCII input from the keyboard and output to the screen. This is extended to the widgets, so you can use them for languages other than English. A new Plasma renderer was added, continuing the theme of retro special effects. This one can be used to create lava-lamp style animated backgrounds. See the new plasma.py sample for an example of how to use it. A `highlight()` method was added to the Screen to allow you to colour wash parts of the screen as if you were using a highlighter pen. This can be used to highlight or lowlight parts of the screen. For an example, have a look at the shadows on a Frame in the forms.py sample. A complete suite of unit tests and CI builds have been created, to ensure that the code continues to run across all supported environments. Latest results are always available at the project home page. Various other minor enhancements and fixes have gone in. For a complete list have a look at the change log: https://raw.githubusercontent.com/peterbrittain/asciimatics/ master/CHANGES.rst ## Where can I find out more? https://github.com/peterbrittain/asciimatics -- https://mail.python.org/mailman/listinfo/python-list
Address boundary error when trying to use Image.putdata(array) from PIL
Got a signal boundary error. Steps to reproduce: open python console Python 2.7.9 (default, Jun 29 2016, 13:08:31) [GCC 4.9.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from PIL import Image >>> im = Image.open('HKJL.jpg') >>> import numpy as np >>> arr = np.array(im) >>> arr[arr < 10] = 0 >>> im.putdata(arr) fish: “python” terminated by signal SIGSEGV (Address boundary error) The image I used: http://i.imgur.com/hnuzhFj.jpg -- https://mail.python.org/mailman/listinfo/python-list
Re: how to automate java application in window using python
On Monday, September 19, 2016 at 6:47:27 PM UTC+12, Christian Gollwitzer wrote: > Still, sometimes you just need to get the job done and it doesn't matter how. That is why the situation continues; because you keep showing a willingness to put up with it. -- https://mail.python.org/mailman/listinfo/python-list
Re: Address boundary error when trying to use Image.putdata(array) from PIL
On 2016-09-24 11:59, Tristan Trouwen wrote: Got a signal boundary error. Steps to reproduce: open python console Python 2.7.9 (default, Jun 29 2016, 13:08:31) [GCC 4.9.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. from PIL import Image im = Image.open('HKJL.jpg') import numpy as np arr = np.array(im) arr[arr < 10] = 0 im.putdata(arr) fish: “python” terminated by signal SIGSEGV (Address boundary error) The image I used: http://i.imgur.com/hnuzhFj.jpg That looks like a bug. I'm on Python 3.5 on Windows and I get an exception: SystemError: new style getargs format but argument is not a tuple From what I've been able to find out, the argument of 'putdata' should be a list (sequence) of tuples. A quicker way is to create a new image from the array: im = Image.fromarray(arr) -- https://mail.python.org/mailman/listinfo/python-list
Re: sphinx (or other means to document python)
On Sunday, September 11, 2016 at 3:56:36 PM UTC-5, chit...@uah.edu wrote: (about being frustrated with sphinx) I _remain_ frustrated - even as I finally figured out how to use it (thanks to a complete example from a friend) sphinx is very picky about spaces, lines - I had a line with some math formula spaces and tabs (after r''' - and sphinx kept ignoring that line when it works, the documentation (my preference is LaTeX) is great - the procedure for embedding the documentation as doctrings can be difficult, at times noweb is considerably simpler - but does not allow for the extraction of docstrings/comments - and does provide for a fairly painless way to combine comments, documentation along with code -- https://mail.python.org/mailman/listinfo/python-list
Re: sphinx (or other means to document python)
pydoctor may be something you're looking for. I don't know if it supports exporting to PDF like Sphinx does. As you've no doubt figured out by now, Sphinx doesn't revolve around the Python files themselves, but rather .rst files in which you can indeed instruct Sphinx to just go and document a module. On Sun, Sep 25, 2016, 02:26 wrote: > On Sunday, September 11, 2016 at 3:56:36 PM UTC-5, chit...@uah.edu wrote: > (about being frustrated with sphinx) > > I _remain_ frustrated - even as I finally figured out how to use it > (thanks to a complete example from a friend) > > sphinx is very picky about spaces, lines - I had a line with some math > formula spaces and tabs (after r''' - and sphinx kept ignoring that line > > when it works, the documentation (my preference is LaTeX) is great - the > procedure for embedding the documentation as doctrings can be difficult, at > times > > noweb is considerably simpler - but does not allow for the extraction > of docstrings/comments - and does provide for a fairly painless way to > combine comments, documentation along with code > -- > https://mail.python.org/mailman/listinfo/python-list > -- Yann Kaiser kaiser.y...@gmail.com yann.kai...@efrei.net +33 6 51 64 01 89 https://github.com/epsy -- https://mail.python.org/mailman/listinfo/python-list