ANN: Leo 4.6 rc1 released
Leo 4.6 rc1 is now available at: http://sourceforge.net/project/showfiles.php?group_id=3458package_id=29106 Leo is a text editor, data organizer, project manager and much more. See: http://webpages.charter.net/edreamleo/intro.html The highlights of Leo 4.6: -- - Cached external files *greatly* reduces the time to load .leo files. - Leo now features a modern Qt interface by default. Leo's legacy Tk interface can also be used. - New --config, --file and --gui command-line options. - Leo tests syntax of .py files when saving them. - Leo can now open any kind of file into @edit nodes. - @auto-rst nodes allow easy editing of reStructuredText files. - Properties of commanders, positions and nodes simplify programming. - Improved Leo's unit testing framework. - Leo now requires Python 2.5 or later. - Dozens of small improvements and bug fixes. Links: -- Leo: http://webpages.charter.net/edreamleo/front.html Forum:http://groups.google.com/group/leo-editor Download: http://sourceforge.net/project/showfiles.php?group_id=3458 Bzr: http://code.launchpad.net/leo-editor/ Quotes: http://webpages.charter.net/edreamleo/testimonials.html Edward K. Ream email: edream...@yahoo.com Leo: http://webpages.charter.net/edreamleo/front.html -- http://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations/
Scientific Computing with Python Webinar: June 19, 2009
Greetings! Enthought is pleased to begin our webinar series designed exclusively for subscribers to Enthought Python Distribution at the Basic or higher level. Webinars in this series will take place on the first Friday of each month, at 1:00 pm Central Time. The format will be a mixture of presentations and discussion. This format provides an opportunity for more freeform exchange than typical webinars. 5 June 2009, 1:00 pm CDT (UTC -5:00) * What's new in EPD: new features in EPD 4.3.0 (20 minutes) o EPD Lab o Whooshdoc o SciPy's new curve_fit function * Creating a mirror for your site: using update and roll-back (20 minutes) * QA (20 to 50 minutes) Please use the following link to register and reserve your seat. https://www1.gotomeeting.com/register/266207560 Forward email http://ui.constantcontact.com/sa/fwtf.jsp?m=1102424111856ea=python-announce-list%40python.orga=1102636686635 This email was sent to python-announce-list@python.org by amen...@enthought.com. Update Profile/Email Address http://visitor.constantcontact.com/d.jsp?p=oov=001DFR05IDUFUXFQLppfBgsYTbLaf8ov-DidTKcJEBRR7Usx_4Ek7JZG96igtG9siEJ Instant removal with SafeUnsubscribe(TM) http://visitor.constantcontact.com/d.jsp?p=unv=001DFR05IDUFUXFQLppfBgsYTbLaf8ov-DidTKcJEBRR7Usx_4Ek7JZG96igtG9siEJ Privacy Policy: http://ui.constantcontact.com/roving/CCPrivacyPolicy.jsp Enthought, Inc. | 515 Congress Ave. | Suite 2100 | Austin | TX | 78701 -- http://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations/
Announcing the 9th Pyweek game programming challenge!
The date for the ninth PyWeek challenge has been set: Sunday 30th August to Sunday 6th September (00:00UTC to 00:00UTC) The PyWeek challenge invites entrants to write a game in one week from scratch either as an individual or in a team. Entries must be developed in Python, during the challenge, and must incorporate some theme chosen at the start of the challenge. REGISTRATION IS NOT YET OPEN -- Registration will open one month before the start date. See the competition timetable and rules: http://www.pyweek.org/9/ PLANNING FOR THE CHALLENGE -- Make sure you have working versions of the libraries you're going to use. The rules page has a list of libraries and other resources. Make sure you can build packages to submit as your final submission (if you're going to use py2exe, make sure you know how to use it and that it works). If you don't have access to Linux, Windows or a Mac to test on, contact friends, family or other competitors to find someone who is able to test for you. -- http://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations/
Announcing freebase-python 1.0
freebase-python is a library for accessing the open data repository stored at http://freebase.com. Freebase is huge, user-edited database of over 100 million of facts about over 5 million topics, all under the Creative Commons CC-BY license. The freebase-python library 1.0 is now available! It introduces a new syntax for accessing the freebase api, it updates the available commands to reflect the entire web api, and it introduces some cool schema manipulation utilities. It's backwards compatible with previous versions of the library. The new syntax makes it easy to start running with freebase: import freebase print freebase.mqlread({id : /en/the_beatles, name : None}) {u'id': u'/en/the_beatles', u'name': u'The Beatles'} You can also access freebase.sandbox as easily: import freebase.sandbox print freebase.sandbox.mqlread(...) freebase-python can now do all of the current api calls that the website handles. For a full list of the api calls and examples, you can refer to http://code.google.com/p/freebase-python/wiki/GettingStarted . The schema manipulation utilities introduced make it easy copy and move types, properties, and objects. This means that you can save bases to your computer so that their survive a sandbox refresh, keep different versions of your bases and types on your own machine, or move types between bases. There are a few recipes on the freebase- python wiki that you can find here: http://code.google.com/p/freebase-python/w/list?can=2q=label%3ARecipe%2CSchema-Manipulation freebase-python is also Google App Engine friendly. You can check out how to write your own app at http://code.google.com/p/freebase-python/wiki/GoogleAppEngine . You can also check out a sample app at http://freebase-images.appspot.com . There are also more test and more docs! Installing is easy, if you have easy_install, just say $ easy_install freebase If you don't have easy_install, you can get it by running http://peak.telecommunity.com/dist/ez_setup.py . -- http://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations/
[ANN] Pyjamas 0.6pre1 ALPHA release of Pyjamas Widget Set
http://pyjs.org - Pyjamas is a port of GWT to Python that can run applications both on the Desktop (like python-gtk2) and in all major Web Browsers (as javascript). This is an alpha release - 0.6pre1 - of the Pyjamas Web Widget Set. It is a significant upgrade, incorporating Pyjamas Desktop which can now use Mozilla XULRunner as well as PyWebKitGtk as the browser engine. Significant enhancements have been made to the javascript compiler, which bring python strict features as well as a relaxed (and faster) compile-time option. The reason for the 0.6 pre-release is due to the number of features and improvements added. Many thanks to Kees, Lovely Systems, and all the people from EuroPython 2009 who have helped contribute and generally make Pyjamas fun to work with. Downloads are available from: http://code.google.com/p/pyjamas http://sourceforge.net/projects/pyjamas http://pypi.python.org/pypi/Pyjamas -- http://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations/
ANN: SciPy 2009 early registration extended to July 17th
The early registration deadline for SciPy 2009 has been extended for one week to July 17, 2009. Please register ( http://conference.scipy.org/to_register ) by this date to take advantage of the reduced early registration rate. About the conference SciPy 2009, the 8th Python in Science conference, will be held from August 18-23, 2009 at Caltech in Pasadena, CA, USA. The conference starts with two days of tutorials to the scientific Python tools. There will be two tracks, one for introduction of the basic tools to beginners, and one for more advanced tools. The tutorials will be followed by two days of talks. Both days of talks will begin with a keynote address. The first day’s keynote will be given by Peter Norvig, the Director of Research at Google; while, the second keynote will be delivered by Jon Guyer, a Materials Scientist in the Thermodynamics and Kinetics Group at NIST. The program committee will select the remaining talks from submissions to our call for papers. All selected talks will be included in our conference proceedings edited by the program committee. After the talks each day we will provide several rooms for impromptu birds of a feather discussions. Finally, the last two days of the conference will be used for a number of coding sprints on the major software projects in our community. For the 8th consecutive year, the conference will bring together the developers and users of the open source software stack for scientific computing with Python. Attendees have the opportunity to review the available tools and how they apply to specific problems. By providing a forum for developers to share their Python expertise with the wider commercial, academic, and research communities, this conference fosters collaboration and facilitates the sharing of software components, techniques, and a vision for high level language use in scientific computing. For further information, please visit the conference homepage: http://conference.scipy.org. Important Dates --- * Friday, July 3: Abstracts Due * Wednesday, July 15: Announce accepted talks, post schedule * Friday, July 17: Early Registration ends * Tuesday-Wednesday, August 18-19: Tutorials * Thursday-Friday, August 20-21: Conference * Saturday-Sunday, August 22-23: Sprints * Friday, September 4: Papers for proceedings due Executive Committee --- * Jarrod Millman, UC Berkeley, USA (Conference Chair) * Gaël Varoquaux, INRIA Saclay, France (Program Co-Chair) * Stéfan van der Walt, University of Stellenbosch, South Africa (Program Co-Chair) * Fernando Pérez, UC Berkeley, USA (Tutorial Chair) -- http://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations/
Re: Colour of output text
On Fri, 10 Jul 2009 09:23:54 +, garabik-news-2005-05 wrote: I would like to learn a way of changing the colour of a particular part of the output text. I've tried the following On Unix operating systems this would be done through the curses interface: http://docs.python.org/library/curses.html Or using ANSI colour codes: colours = { 'none' :, 'default':\033[0m, 'bold' :\033[1m, [snip] # non-standard attributes, supported by some terminals This comment should have appeared immediately after none ;) Hard-coding control/escape sequences is just lame. Use the curses modules to obtain the correct sequences for the terminal. -- http://mail.python.org/mailman/listinfo/python-list
Re: tough-to-explain Python
On Fri, 10 Jul 2009, Hendrik van Rooyen wrote: Steven D'Aprano st...@remove-this-cye.com.au wrote: On Wed, 08 Jul 2009 22:05:57 -0700, Simon Forman wrote: [...] Programming is not like any other human activity. In practice? In principle? Programming in principle is not the same as it is performed in practice. But in either case, programming requires both the logical reasoning of mathematics and the creativity of the arts. Funnily enough, I do not buy this arty creativity stuff. - or are you talking about making a website look pretty? mathematicians will tell you that mathematics requires the same, and so will the best artists. I think mathematicians, engineers, artists, even great chefs, will pour scorn on your claim that programming is not like any other human activity. So a chef is now an authority on programming? Programming is actually kind of different - almost everything else is just done, at the time that you do it. Programming is creating stuff that is completely useless until it is fed into something that uses it, to do something else, in conjuction with the thing it is fed into, at a later time. This is a highly significant difference, IMHO. [...] The drawings produced by an architect, the script of a play, the score of a piece of music, and the draft of a piece of legislation are all examples of other things which are useless until they are interpreted in some way. There are countless human activities which require a program, i.e. a conscious plan or strategy, formed at least partly by a creative process, and a computer program is just a special case of this. I use Python as a tool for writing music, but I find I need both logical reasoning and creativity to do either. In fact, I find programming very similar to writing music in a rigorous contrapuntal style, where each set of choices constrains each other, and there is a deep aesthetic satisfaction in getting it right. Regards, John -- http://mail.python.org/mailman/listinfo/python-list
Re: Addind imports to a class namespace
Ryan K wrote: In order to avoid circular imports, I have a class that I want to improve upon: Class GenerateMenuXhtml(threading.Thread): Subclasses a threading.Thread class to generate a menu's XHTML in a separate thread. All Link objects that have this menu associated with it are gathered and combined in an XHTML unordered list. If the sender is of type Link, then all menus associated with that link are iterated through and rebuilt. def __init__(self, instance): from asqcom.apps.staticpages.models import Menu, Link self.Link = Link self.Menu = Menu As you can see I just expose these imports by attaching them to members of the class. There must be prettier option though where I can just add these imoprts to the class's namespace so all methods of any instance will have access to the imported modules. How would I go about doing this? How can I access the namespace of any class? Through Class.__dict__? You can write either class A(object): from some.module import Menu, Link or class A(object): @classmethod do_imports(cls): from some.module import Menu, Link cls.Menu = Menu cls.Link = Link A.do_imports() to put the names into the class. The first form performs the import while the containing module is imported and therefore won't help with breaking circles. In the second form you have to defer the A.do_imports() method call until the import from some.module is safe. But I still recommend that you have another look at your package organization to find a way to avoid circles. Peter -- http://mail.python.org/mailman/listinfo/python-list
Re: tough-to-explain Python
I V ivle...@gmail.com (IV) wrote: IV On Fri, 10 Jul 2009 16:27:12 -0400, Terry Reedy wrote: a bug, bug a limitation due to using limited-range numbers. If one uses residue classes instead of integers, and makes no adjustment, I consider it wrong to blame Bentley. IV But it was Bentley himself who used the C int type, so it hardly seems IV unreasonable to blame him. If you are on a 32-bit machine, and the array to be searched contains ints, floats or doubles, the the array must be 2^32 bytes in size, and as each element is at least 4 bytes, the indices are less than 2^30, so l+u 2^31. Therefore there is no overflow at all. I think the Bentley programs were formulated in terms of arrays of ints. So his implementations were safe. If you are on a 64-bit machine you shouldn't use int for the indices anyway (supposing int is 32 bits) but longs and then the same reasoning shows that there are no overflows. Only when you have an array of shorts or bytes (chars) you get the problem. In that case the alternative formulation l + (u-l)/2 is more robust and therefore preferable. -- Piet van Oostrum p...@cs.uu.nl URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4] Private email: p...@vanoostrum.org -- http://mail.python.org/mailman/listinfo/python-list
Re: Tkinter only: table widget with canvas...
There's a working app at http://cl1p.net/tkinter_table_headers/ -John Thank you for this example. However, one issue to that... When resizing the window (vertical) then the header moves away from the table. How can I avoid this with the grid? With pack I now this... -- http://mail.python.org/mailman/listinfo/python-list
Re: windows explorer integration
2009/7/11 Laurent Luce laurentluc...@yahoo.com: Do you know if it is possible to write a plugin for windows explorer using win32 module ? Yes, I believe it is. There are a number of Python projects (I believe TortoiseHg is one) that do this sort of thing. However, I don't know anything about how to do it - you should check MSDN, the PyWin32 samples, and maybe something like TortoiseHg, for sample code. Paul. -- http://mail.python.org/mailman/listinfo/python-list
Re: Automate rsync w/ authentication
In article 3af970b1-b454-4d56-a33f-889ecfaca...@l28g2000vba.googlegroups.com, Bryan bryanv...@gmail.com wrote: rsyncExec = '/usr/bin/ssh' source = 'r...@10.0.45.67:/home/bry/jquery.lookup' dest = '/home/bry/tmp' rshArg = '-e /usr/bin/ssh -i /home/bry/keys/brybackup.key' args = [rsyncExec, '-a', '-v', '--dry-run', rshArg, source, dest] I think you want -e and the ssh command to be separate args. Something like: rshArg = '/usr/bin/ssh -i /home/bry/keys/brybackup.key' args = [rsyncExec, '-a', '-v', '--dry-run', '-e', rshArg, source, dest] or: rshArgs = [ '-e', '/usr/bin/ssh -i /home/bry/keys/brybackup.key' ] args = [rsyncExec, '-a', '-v', '--dry-run'] + rshArgs + [ source, dest] Gary Duzan Motorola HNM -- http://mail.python.org/mailman/listinfo/python-list
Re: problem with keys combination!
Blocking Ctrl-Alt-Del leaves the power switch or maybe the plug as the only way for the user to regain control. Why would you want to do that? ONly for the reason that I explaine above...is for my little joke application ! And I want disable all keys for about 30 seconds (time to erase background) I read about getasynckey() to intercept a key...but I don't know how to change key pressed with another...maybe a solution ? Alex -- http://mail.python.org/mailman/listinfo/python-list
Re: Why not enforce four space indentations in version 3.x?
On Jul 10, 2:22 pm, walterbyrd walterb...@iname.com wrote: I believe Guido himself has said that all indentions should be four spaces - no tabs. Since backward compatibility is being thrown away anyway, why not enforce the four space rule? There is a routine in the Scripts directory, reindent.py, that will take your source file(s) and remove tabs, unify the indents to 4- spaces, remove needless characters at the end of lines, etc. IIRC, it was written by Tim Peters. We run all of our source files though before checking them into svn. --greg -- http://mail.python.org/mailman/listinfo/python-list
Re: tough-to-explain Python
Steven D'Aprano st...@remove-this-cyb.ce.com.au wrote: On Fri, 10 Jul 2009 12:54:21 +0200, Hendrik van Rooyen wrote: Steven D'Aprano st...@remove-this-cye.com.au wrote: On Wed, 08 Jul 2009 22:05:57 -0700, Simon Forman wrote: persistent idea out there that programming is a very accessible skill, like cooking or gardening, anyone can do it, and even profit from it, monetarily or otherwise, etc., and to some extent I am Programming is not like any other human activity. In practice? In principle? Programming in principle is not the same as it is performed in practice. But in either case, programming requires both the logical reasoning of mathematics and the creativity of the arts. Funnily enough, I do not buy this arty creativity stuff. - or are you talking about making a website look pretty? I must admit, it never crossed my mind that anyone here would claim that there was no creativity involved in programming, that it was all a mindless, algorithmic process capable of being done by a simple mechanical device. Programming is the step of going from the design to something that tells the machine how to implement the design. The creativity could, arguably, be in the Design. Not in the translation to python, or assembler. No way. That is just coding. This is certainly the accusation made against *bad* programmers -- that they can't actually solve new, unique problems, but just apply recipes they learned without any insight or intelligence. The sort of people who program so poorly that a trained monkey could do what they do. Do you really think that applies to good programmers too? If so, then a good code generator should be able to replace any programmer. Is that what you believe? Should eventually be possible, with sufficient restrictions to start off. UML wants to go this route... But may my eyes be stopped and my bones be heaped with dust ere I see the day... mathematicians will tell you that mathematics requires the same, and so will the best artists. I think mathematicians, engineers, artists, even great chefs, will pour scorn on your claim that programming is not like any other human activity. So a chef is now an authority on programming? Did I say that? No. I just read it like that to irritate you. Chefs are authorities on OTHER HUMAN ACTIVITIES. Programming is actually kind of different - almost everything else is just done, at the time that you do it. Programming is creating stuff that is completely useless until it is fed into something that uses it, to do something else, in conjuction with the thing it is fed into, at a later time. Somebody should teach Hendrik that human beings have been creating TOOLS for hundreds of thousands of years. People have been creating tools to build tools for thousands of years. Software is just more of the same. I disagree - I actually own some machine tools, so I am a little bit acquainted with what they can do, and it is not at all like computing at any level I can think of - they are merely extensions of the hand, making the transformation of materials more accurate and faster. The line only becomes blurred when a processor is added, and a STORED PROGRAM is brought into the equation. Even *soup stock* fits the same profile as what Hendrik claims is almost unique to programming. On its own, soup stock is totally useless. But you make it, now, so you can you feed it into something else later on. Or instant coffee. No, Henrik, if that's the best you can do, it's not very good. It is rather sad, but also hilarious, that the most different thing you have noticed about software is that it's just like instant coffee. You have a wonderful ability to grab hold of part of a definition and to ignore the rest, just like I can misread what you write. Coffee and soup stay coffee and soup on re hydration. Mixing it in with something else is not at all the same - it does not DO anything else in conjunction with the thing it is fed into - how is that like programming, and executing a program? I am sorry if you are confusing the drinking of coffee, which is an ancilliary activity to programming, with the actual programming itself. This is a highly significant difference, IMHO. [...] He talks about how when all is said and done, the only thing computers can do for us is to manipulate symbols and produce results of such manipulations and he emphasises the uninterpreted nature of mechanical symbol manipulation, i.e. that the machine is doing it mindlessly. Manipulate symbols is so abstract as to be pointless. By that reasoning, I can build a computer consisting of a box open at the top. I represent a symbol by an object (say, a helium-filled balloon, or a stone), instead of a pattern of bits. I manipulate the symbol by holding the object over the box and letting go. If it flies up into the sky, that represents the symbol Love is War, if it falls into the box, it represents the symbol Strength
Re: tough-to-explain Python
pdpi pd...@gmail.com wrote; I've always found cooking an apt metaphor for programming. No this is wrong. Writing a recipe or a cookbook is like programming. Cooking, following a recipe, is like running a program. - Hendrik -- http://mail.python.org/mailman/listinfo/python-list
Re: Tkinter only: table widget with canvas...
There's a working app at http://cl1p.net/tkinter_table_headers/ Thank you for this example. However, one issue to that... When resizing the window (vertical) then the header moves away from the table. How can I avoid this with the grid? With pack I now this... Oops ... packing can be tricky. Try these modifications: header_frm.pack(side=TOP, anchor=W, expand=False) ... table_frm.pack(side=TOP, expand=True, fill=BOTH) You also might try constraining the top-level (root) window, using these methods: rt.geometry(XXX, YYY) rt.resizable(False, True) -John -- http://mail.python.org/mailman/listinfo/python-list
Re: Addind imports to a class namespace
Thanks for your help Peter. I'm thinking that perhaps this isn't a circular import and that I don't understand importing. Here is a better explanation of my case (I am using Django): I have file x.py that declares classes A, B, C. There is also a file y.py that contains two methods T, U and the class that we are talking about above. x.py uses a dispatcher system to connect a signal to methods T and U in y.py so it does: from y import T, U. y.py needs to use classes A, B, C which is basically Menu and Link (and some other class) above so I am thinking that if in y.py I have from x import A, B, C that will cause a circular import? Is this not correct and if it isn't can you explain why? Does using from ... import X, Y, Z, i.e. explicit imports avoid this problem or does it exacerbate it? Thanks, Ryan -- http://mail.python.org/mailman/listinfo/python-list
Re: windows explorer integration
Hi! Possible! With Pywin32. I see two ways: - add a toolBar ; see the exemple for Internet-Explorer (it run for both, IE explorer) - add an entry in the context menu (right click) @-salutations -- Michel Claveau -- @-salutations Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list
Re: psyco V2 beta2 benchmark
larudwer, is that time_subdist subdist(i) a bad worsening? Something to be fixed in Psyco2? Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list
Re: tough-to-explain Python
Steven D'Aprano wrote: Even *soup stock* fits the same profile as what Hendrik claims is almost unique to programming. On its own, soup stock is totally useless. But you make it, now, so you can you feed it into something else later on. Or instant coffee. I think I'll avoid coming to your house for a cup of coffee. :-) --Scott David Daniels scott.dani...@acm.org -- http://mail.python.org/mailman/listinfo/python-list
Re: Addind imports to a class namespace
Ryan K wrote: I'm thinking that perhaps this isn't a circular import and that I don't understand importing. Here is a better explanation of my case (I am using Django): I have file x.py that declares classes A, B, C. Classes in Python are executable code, just like import-statements. That's why there is no Python equivalent to forward declarations in other languages; every name has to be known at the point where it occurs in the module. There is also a file y.py that contains two methods T, U and the class that we are talking about above. x.py uses a dispatcher system to connect a signal to methods T and U in y.py so it does: from y import T, U. y.py needs to use classes A, B, C which is basically Menu and Link (and some other class) above so I am thinking that if in y.py I have from x import A, B, C that will cause a circular import? Yes. Having x import y and y import x creates a cycle. If you cannot avoid this by moving to a simpler design you can always introduce a third module z that imports x and y, and then explicitly resolves the circular references. Is this not correct and if it isn't can you explain why? Does using from ... import X, Y, Z, i.e. explicit imports avoid this problem or does it exacerbate it? It has no effect. from module import X is equivalent to import module X = module.X del module # just the name, not the module itself Peter -- http://mail.python.org/mailman/listinfo/python-list
Re: tough-to-explain Python
On Sat, 11 Jul 2009 14:01:25 +0200 Hendrik van Rooyen m...@microcorp.co.za wrote: Programming is the step of going from the design to something that tells the machine how to implement the design. The creativity could, arguably, be in the Design. Not in the translation to python, or assembler. No way. That is just coding. One might also argue that divorcing the design from the code is the problem in a lot of legacy code. See Agile Programming methods. Now you could say that there is a design step still in talking to the client and making a plan in your head or in some notes but that's like saying that Michelangelo was done creating after discussing the Sistine Chapel with Pope Sixtus and that the rest was just a house painting job. -- D'Arcy J.M. Cain da...@druid.net | Democracy is three wolves http://www.druid.net/darcy/| and a sheep voting on +1 416 425 1212 (DoD#0082)(eNTP) | what's for dinner. -- http://mail.python.org/mailman/listinfo/python-list
Re: tough-to-explain Python
D'Arcy J.M. Cain d...@druid.net One might also argue that divorcing the design from the code is the problem in a lot of legacy code. See Agile Programming methods. Now you could say that there is a design step still in talking to the client and making a plan in your head or in some notes but that's like saying that Michelangelo was done creating after discussing the Sistine Chapel with Pope Sixtus and that the rest was just a house painting job. How do you know that it was not exactly like that - he did, after all, take a much longer time than expected to complete the job - just like a house painter that gets paid by the hour. :-) It is also unreasonable to assume the opposite fallacy - that he was in a creative frenzy from the start to the time at the end when he was cleaning his brush after applying the last spot of paint. But it is a valid point - it is often difficult to draw the line between the design and the implementation - and one of the reasons that we all like to program in python, is that it is almost a language that is a design language that can also be run directly. - I have lately been doing stuff like writing rough prototypes using python syntax to serve as designs for some of the assembler thingies I do. If you muck around a bit at the lower level, you will also be more aware of the dichotomy between the design and the implementation - in python, it is not obvious at all. In assembler, it is glaring. But in either place, if you get it wrong, you suffer. - your programs cripple along, or they hardly do what you thought they would, and they bear no relationship with what the customer wanted. - Hendrik -- http://mail.python.org/mailman/listinfo/python-list
Re: tough-to-explain Python
John O'Hagan wrote: The drawings produced by an architect, the script of a play, the score of a piece of music, and the draft of a piece of legislation are all examples of other things which are useless until they are interpreted in some way. Granted. But... There are countless human activities which require a program, i.e. a conscious plan or strategy, formed at least partly by a creative process, and a computer program is just a special case of this. The difference is that for a piece of music, or a recipe for bobotie, there is room for artistry also in the performance or preparation. If the piece of music is reduced to a scroll with holes in it and played on a pianola, then nobody in his right mind would call the mechanically produced sounds a great performance. And this is the essential difference that sets programming apart from cookbook writing or drawing architectural plans - the one thing that makes the real difference is the mindlessness of the performer. (maybe I should conceed that writing legislation is a form of programming, as the constabulary does not have a reputation for anything other than a plodding consistency) I use Python as a tool for writing music, but I find I need both logical reasoning and creativity to do either. In fact, I find programming very similar to writing music in a rigorous contrapuntal style, where each set of choices constrains each other, and there is a deep aesthetic satisfaction in getting it right. Getting it right has to do with the design, not the programming - Have you ever struggled to get something right, and then one day you take a different tack, and suddenly it is as if you cannot do anything wrong - everything just falls into place? - That is the time that you get the good feeling. The difference between the one and the other is the difference between bad or indifferent design and good design. When you have a good design, the rest follows. If your design is crud, no matter what you do, you struggle and nothing comes out just right, despite heroic effort. Now this stuff is easy to talk about, and immensely difficult to do - it takes experience, some skill, some cunning, and a willingness to experiment in an egoless fashion, amongst other things. And then the stupid compiler completely screws up your intent... :-) - Hendrik -- http://mail.python.org/mailman/listinfo/python-list
Re: hoe to build a patched socketmodule.c
Scott David Daniels wrote: jacopo mondi wrote: Roger Binns wrote: jacopo mondi wrote: Hi all, I need to patch socketmodule.c (the _socket module) in order to add support to an experimental socket family. You may find it considerably easier to use ctypes since that will avoid the need for any patching. You'll also be able to control how read and write are done (eg read vs recvfrom vs recvmsg vs readv). You can use os.fdopen to convert your raw file descriptor into a Python file object if appropriate. The typical Python way of dealing with this is an additional module, not a modified module placed back in the library. So, take the sources and edit, but change the module name. Even better is figure out how to use _socket.pyd, to create a smaller _socketexpmodule.c and use that. --Scott David Daniels scott.dani...@acm.org Thanks a lot Scott. If I'll write a new module, with a new name, based on socketmodule.c I will not be able to ditribuite the source code and make users compile it using distutils, instead I have to compile it using the whole python build system (changing setup.py in python sources to let it know about my new module) and distribuite the compiled .so with a script to install it, I suppose. Anyway, that's not too bad... Reusing _socket.so, or the main wrapper socket.pyc I think is not possible, because I need to modify low level functions that are not exposed thanks again jacopo -- http://mail.python.org/mailman/listinfo/python-list
Re: Addind imports to a class namespace
Okay so below is the acutal code. I am starting to think there is no reason why I can't install the post_save signal in signals.py itself and thereby avoid this issue entirely. models.py: class Link(CommonAbstractModel): ... class Menu(CommonAbstractModel): class StaticPage(CommonAbstractModel): ,,, class CachedMenuXhtml(CommonAbstractModel): ... post_save.connect(signals.build_menu, sender=Link) post_save.connect(signals.build_menu, sender=Menu) # Signlas for caching of menu XHTML class GenerateMenuXhtml(threading.Thread): def __init__(self, instance): from asqcom.apps.staticpages.models import Menu, Link, CachedMenuXhtml self.Link = Link self.Menu = Menu self.CachedMenuXhtml = CachedMenuXhtml # Function to run on post_save signal def build_menu(sender, instance, **kwargs): GenerateMenuXhtml(instance).start() -- http://mail.python.org/mailman/listinfo/python-list
asyncore's lack of sendto(), recvfrom()
Is there any good reason why sendto() and recvfrom() aren't wrapped by asyncore? Obviously, recvfrom() cannot be replaced by recv(), but even sendto() cannot be replace by connect() and send(), either: I'm writing a traceroute module, and I found out that under the current firewall configuration of my OS, sending an ICMP packet via sendto() doesn't trigger a connection confirmation (the packet is silently and successfully sent), while connect() does (the firewall reports an attempted UDP connection, I'm sure why). I know Python merely wraps send() and sendto() from sys/socket.h of the OS, obviously there are some important subtle differences between the two. Now, if I'd want to add sendto() and recvfrom() to asyncore, would it be sufficient to simply copying its send() and recv() wrapper functions and change the names and arguments, or are there more modifications required? -- http://mail.python.org/mailman/listinfo/python-list
Re: Re: Addind imports to a class namespace
Ryan K wrote: Thanks for your help Peter. I'm thinking that perhaps this isn't a circular import and that I don't understand importing. Here is a better explanation of my case (I am using Django): I have file x.py that declares classes A, B, C. There is also a file y.py that contains two methods T, U and the class that we are talking about above. x.py uses a dispatcher system to connect a signal to methods T and U in y.py so it does: from y import T, U. y.py needs to use classes A, B, C which is basically Menu and Link (and some other class) above so I am thinking that if in y.py I have from x import A, B, C that will cause a circular import? Is this not correct and if it isn't can you explain why? Does using from ... import X, Y, Z, i.e. explicit imports avoid this problem or does it exacerbate it? Thanks, Ryan You indeed have described a circular import. In this case, a mutual dependency exists between x.py and y.py. This can and nearly always should be avoided. That's independent of the language involved, in any language, circular dependencies are a code smell Now, in Python in particular, first question is whether either x.py or y.py is your main script module (the one where you do the if __name__ == __main__ and the answer is yes). If so, you're in big trouble, and you really need to rework it. I could elaborate if needed, but trust me, you don't want to do this, even if it means writing one more module containing a single import line and just two or three more, and letting that be your script. If that's not the case, next question is whether either module refers to the other one at import time, or only from inside def and class definitions. If you have any top-level code going on, other than imports, and this code actually uses a symbol from the other module, you're probably in trouble. Not as bad as first case, but still worth avoiding. Sometimes this can be kludged past, by reordering things a little bit, maybe by moving one of the imports further down in the file. Now back to the code smell. If the modules really depend on each other, you should consider factoring out those dependencies and move them to a third module that both import. Figure out why the modules are broken up in the particular way they are, and how you can eliminate circular references by refactoring. It's hard for me to come up with general principles, but perhaps an example or three will help. If a callee needs configuration information stored in globals of the caller, then you probably need to add that config information as parameters. If an object needs a reference to functions in another module, add them when constructing the object, not statically. Or maybe even have the one module explicitly set global variables in the other module, so they're in one place, instead of being only in the namespace of the code initializing them. That's the best I can do without something concrete to adjust. DaveA -- http://mail.python.org/mailman/listinfo/python-list
Re: Clarity vs. code reuse/generality
2009/7/11 Steven D'Aprano st...@remove-this-cybersource.com.au: So is design-by-contract just another way of saying let's hope the data is valid, because if it's not, we're screwed? Not at all. Design By Contract is about assigning responsibility for checking. If you don't assign responsibility then a pile of things end up getting checked over and over again, because everybody is assuming responsibility, and some things don't get checked at all because everyone assumes that somebody else is checking. In DbC, the pre-condition on data coming in to a program from outside will usually simply be true -- nothing at all is assumed about it. But when you pass it from an input conditioning routine to a processing routine, the input conditioning routine should be able to make guarantees about what it passes, and the processing routine should be able to assume that those guarantees are met without having to check it again (after all, what was the conditioning routine there for?). Assertions might be useful in testing (because they save having to repeat the same set of test cases on absolutely every test run) and they're certainly useful in documenting, but if they're any use at all in the production run-time then there's something wrong with your development and testing processes. -- Tim Rowe -- http://mail.python.org/mailman/listinfo/python-list
Re: Threading.Condition problem
Gabriel Rossetti gabriel.rosse...@arimaz.com (GR) wrote: GR Sorry if this appears twice, I sent it once with an attachment and it never GR arrived so maybe the attachment is posing problems. I inlined the code this GR time (at the bottom), thank you, GR Gabriel GR ## Original message GR Hello everyone, GR I wrote a small example that listens for xmpp msgs in a thread. The main GR program calls a function that blocks (using Condition.wait) until a msg GR has been received and then returns the msg. When a msg arrives, it is GR put in a variable in the thread's object, it then calls the notify() GR attr on the Condition object. For some reason, this doesn't work, the GR thread gets the msg, tries to notify the Condition object, fails because GR the lock has not been acquired yet and blocks. I tried ignoring the GR failure, thinking that since it has not been acquired yet then when it GR is, it will get the msg right away and never call Condition.wait, thus GR not causing any problems, but this does not work either. Does someone GR know what I am doing wrong? I attached the code to this msg. The code that puts the message in the variable should also acquire the lock: def onMessage(self, conn, msg): with self._cv: self.message = msg self._cv.notify() A couple of remarks: 1. I think the code is neater if all manipulation with the condition is done in the same class (actually in the same instance -- making this instance into a monitor). class Listener(Thread): def __init__(self, ws): Thread.__init__(self) self.interrupt = Event() self.message = None self._cv = Condition() self.client = ws._client self.client.RegisterHandler('message', self.onMessage) def onMessage(self, conn, msg): with self._cv: self.message = msg try: self._cv.notify() except RuntimeError: print self._cv has not acquired the lock yet def getMsg(self): with self._cv: while !self.message self._cv.wait() return self.message class WS(object): def __init__(self, username, password, res): self._jid = xmpp.protocol.JID(username) self._client = xmpp.Client(self._jid.getDomain()) #self._cv = Condition() def getMsg(self, mid=None): return self._listener.getMsg() Of course I haven't tested this code as I don't have the context modules. 2. I don't know if more than one message can be delivered in the same instance. If yes, than your code will not work, and neither will the code above as, the message instance variable is never cleared. So the next getMsg will be happy to deliver the previous one. You would have to clear it when returning this one. def getMsg(self): with self._cv: while !self.message self._cv.wait() msg = self.message self.message = None return msg 3. If the messages come in faster than they can be processed some will be lost as they will overwrite the previous one in the self.message variable. The solution is to use a threading.Queue to transfer the messages from one thread to the other. This also saves you the hassle of doing your own synchronisation like above. If you are not familiar with synchronising multithreaded applications it is very easy to make errors and even if you are it is quite easy to do them wrong. I have been involved in distributed programming courses at university level and I have seen many errors in this area. -- Piet van Oostrum p...@cs.uu.nl URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4] Private email: p...@vanoostrum.org -- http://mail.python.org/mailman/listinfo/python-list
Re: Package for fast plotting of many data points in Python?
Hi, thanks for your repleys. I have tried matplotlib but it is extremely slow. I think it is more optimized for good looking plots instead of speed. I do not know the Python bindings of gnuplot and Veusz. To clarify the issue again, by 25000 data points I mean 25000 pixels, i.e. corresponding (x,y) pairs. Thus the mapping to one pixel on the screen is not unique. Now, that I have to implement this problem on my own I am very impressed by the plotting capabilities of LabView which brings thounds of data points on screen in an extremely short time. Thanks for your help. Best regards, Daniel -- http://mail.python.org/mailman/listinfo/python-list
Re: Package for fast plotting of many data points in Python?
Daniel Platz mail.to.daniel.pl...@googlemail.com writes: I do not know the Python bindings of gnuplot and Veusz. A web search does, though. URL:http://clusty.com/search?query=gnuplot+python URL:http://clusty.com/search?query=veusz+python -- \“The problem with television is that the people must sit and | `\keep their eyes glued on a screen: the average American family | _o__) hasn't time for it.” —_The New York Times_, 1939 | Ben Finney -- http://mail.python.org/mailman/listinfo/python-list
Re: 2.4 VS 3.1 for simple print
In message 87hbxkm7n2@benfinney.id.au, Ben Finney wrote: For this and other differences introduced in the Python 3.x series, see URL:http://www.python.org/dev/peps/pep-3100/. People never thank you for an RTFM response. -- http://mail.python.org/mailman/listinfo/python-list
Re: The meaning of = (Was: tough-to-explain Python)
In message h37gv5$r8...@panix3.panix.com, Aahz wrote: It helps to remember that names and namespaces are in many ways syntactic sugar for dicts or lists. Interesting, though, that Python insists on maintaining a distinction between c[x] and c.x, whereas JavaScript doesn't bother. -- http://mail.python.org/mailman/listinfo/python-list
Re: tough-to-explain Python
Hendrik van Rooyen wrote: The creativity could, arguably, be in the Design. Not in the translation to python, or assembler. No way. That is just coding. No, the mechanical part of the process is called compiling, and we have programs to do it for us. By the time you've specified the design so rigorously that not the slightest spark of creativity is needed to implement it, you *have* coded it. -- Greg -- http://mail.python.org/mailman/listinfo/python-list
Re: The meaning of = (Was: tough-to-explain Python)
Lawrence D'Oliveiro wrote: Interesting, though, that Python insists on maintaining a distinction between c[x] and c.x, whereas JavaScript doesn't bother. And that distinction is a good thing. It means, for example, that dictionaries can have methods without colliding with the key space of the items put into them. -- Greg -- http://mail.python.org/mailman/listinfo/python-list
explode()
What is the Python equivalent of the PHP explode() function? Fred -- http://mail.python.org/mailman/listinfo/python-list
Re: explode()
On Sat, Jul 11, 2009 at 7:41 PM, Fred Atkinsonfatkin...@mishmash.com wrote: What is the Python equivalent of the PHP explode() function? some_string.split(separator) Cheers, Chris -- http://blog.rebertia.com -- http://mail.python.org/mailman/listinfo/python-list
Re: explode()
On Sat, 11 Jul 2009 18:50:28 -0700, Chris Rebert c...@rebertia.com wrote: On Sat, Jul 11, 2009 at 7:41 PM, Fred Atkinsonfatkin...@mishmash.com wrote: What is the Python equivalent of the PHP explode() function? some_string.split(separator) Cheers, Chris Thanks, Fred -- http://mail.python.org/mailman/listinfo/python-list
Re: A zlib question
Roland Hedberg roland at catalogix.se writes: I have a problem with zlib and compressing/decompressing according to RFC 1951. It seems like I can decompress, something compressed according to RFC 1951 by someone else, provided I set wbits to something negative (used -8 but I guess any negative number would work?). -15 will get you a 32KB window which is the best and is the default in APIs where a default is possible. original_data = zlib.decompress(deflated_data, -15) But how can I compress using zlib so it doesn't add a gzip header ? You don't need to, because zlib doesn't add a gzip header (RFC 1952) -- it adds a zlib header (RFC 1950) ... without out any frills (i.e. default case) a zlib stream is a 2-byte header plus the RFC 1951 deflate stream plus a 4-byte checksum. deflated_data = zlib.compress(uncompressed_data)[2:-4] Coincidentally this question arose elsewhere very recently: see http://stackoverflow.com/questions/1089662/ python-inflate-and-deflate-implementations concatenate the above two lines -- gmane = 80-byte line limit 8-P BTW FWIW, one can evidently force zlib to do a gzip wrapper instead of a zlib wrapper by setting wbits to positive 15 [brilliant API design], but one might be better off using the gzip module directly ... HTH, John -- http://mail.python.org/mailman/listinfo/python-list
Re: The meaning of = (Was: tough-to-explain Python)
In article h3bagu$52...@lust.ihug.co.nz, Lawrence D'Oliveiro l...@geek-central.gen.new_zealand wrote: In message h37gv5$r8...@panix3.panix.com, Aahz wrote: It helps to remember that names and namespaces are in many ways syntactic sugar for dicts or lists. Interesting, though, that Python insists on maintaining a distinction between c[x] and c.x, whereas JavaScript doesn't bother. Why do you say insists? class AttrDict: def __getitem__(self, key): return getattr(self, key) -- Aahz (a...@pythoncraft.com) * http://www.pythoncraft.com/ as long as we like the same operating system, things are cool. --piranha -- http://mail.python.org/mailman/listinfo/python-list
[issue6460] test failure in test_xmlrpc on Gentoo in trunk
Ned Deily n...@acm.org added the comment: FWIW, I've just seen a couple of intermittent 'test_two' failures with a current py3k on OS X but, in each case, the test passed when auto rerun in verbose mode. test test_xmlrpc failed -- Traceback (most recent call last): File /Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/test/te st_xmlrpc.py, line 514, in test_two self.assertTrue(len(self.RequestHandler.myRequests[-1]) = 2) AssertionError: False is not True -- nosy: +nad ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6460 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6461] multiprocessing: freezing apps on Windows
New submission from Stuart Mentzer s...@objexx.com: Freezing apps with multiprocessing on Windows seems to be broken. First, in get_command_line in multiprocessing/forking.py I find that this code: if getattr(sys, 'frozen', False): return [sys.executable, '--multiprocessing-fork'] else: prog = 'from multiprocessing.forking import main; main()' return [_python_exe, '-c', prog, '--multiprocessing-fork'] should be: elif getattr(sys, 'frozen', False) and not WINEXE: return [sys.executable, '--multiprocessing-fork'] else: prog = 'from multiprocessing.forking import main; main()' return [_python_exe, '-c', prog, '--multiprocessing-fork'] in order for the _python_exe set with multiprocessing.set_executable to be used rather than your app's exe. Second, I can then get a working frozen package if I include pythonw.exe (and use set_executable to point to it) and a subset of Python's Lib directory that my process needs to call. If this is as intended then it needs to be documented. This may just be a flaw in py2exe. Third, the multiprocessing documentation page description for set_executable has example code with the older setExecutable call. -- components: Library (Lib) messages: 90405 nosy: sgm severity: normal status: open title: multiprocessing: freezing apps on Windows versions: Python 2.6 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6461 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6460] test failure in test_xmlrpc on Gentoo in trunk
Kristján Valur Jónsson krist...@ccpgames.com added the comment: This is probably a race condition, where the server thread hasn't updated the stats yet when the client is testing them. I'm so used to work with non-preemtive scheduling in stackless python that I sometimes forget how threads work :) I submitted revision 73932 for the trunk, please test. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6460 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6358] os.popen exit code inconsistent
Amaury Forgeot d'Arc amaur...@gmail.com added the comment: Added a few tests, and fixed in r73934 (py3k) and r73935 (3.1) Thanks for the report! -- nosy: +amaury.forgeotdarc resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6358 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6459] Lib/distutils\tests\test_build_ext.py fails on VC6
Amaury Forgeot d'Arc amaur...@gmail.com added the comment: Confirmed with vs2008. I wonder why the buildbots don't fail. -- nosy: +amaury.forgeotdarc ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6459 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6446] import_spam() in extending python can fail without setting the error.
Georg Brandl ge...@python.org added the comment: Thanks, fixed in r73938. -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6446 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6448] imp.find_module() -- be explicity that 'path' must be a list
Georg Brandl ge...@python.org added the comment: I reworded the paragraph a bit in r73939. -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6448 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6459] Lib/distutils\tests\test_build_ext.py fails on VC6
Tarek Ziadé ziade.ta...@gmail.com added the comment: Thanks for the patch, I'll integrate asap. Notice that I run the tests under windows but without a full range of VC versions, so I count a lot on the buildbots to show me these kind of failures. -- priority: - normal resolution: - accepted ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6459 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6430] array.array falsely advertises support for 'w' in documentation
Georg Brandl ge...@python.org added the comment: OK, fixed this in r73940, r73941, r73942. -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6430 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6421] errors in docs re module initialization vs self arg to functions
Georg Brandl ge...@python.org added the comment: Fixed both instances in r73943. -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6421 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1921] Confusing Descrintro example
Changes by Georg Brandl ge...@python.org: -- assignee: georg.brandl - gvanrossum nosy: +gvanrossum ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1921 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6459] Lib/distutils\tests\test_build_ext.py fails on VC6
Tarek Ziadé ziade.ta...@gmail.com added the comment: Mmm, also notice that the current build_ext trunk uses init in the code, which means that the PyInit prefix was added on py3k but not backported in the trunk. So i'll fix that too -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6459 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6456] locale.D_* and .T_* are int, not string
Georg Brandl ge...@python.org added the comment: I moved the constants' description into the nl_langinfo() description and clarified their use in r73945. -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6456 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6269] threading documentation makes no mention of the GIL
Changes by Georg Brandl ge...@python.org: -- assignee: georg.brandl - jnoller ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6269 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6459] distutils.command.build_ext.get_export_symbols should use the PyInit prefix rather then init
Tarek Ziadé ziade.ta...@gmail.com added the comment: The bug also exists in 2.6 so I'm backporting the fix -- title: Lib/distutils\tests\test_build_ext.py fails on VC6 - distutils.command.build_ext.get_export_symbols should use the PyInit prefix rather then init versions: +Python 2.6, Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6459 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6459] distutils.command.build_ext.get_export_symbols should use the PyInit prefix rather then init
Tarek Ziadé ziade.ta...@gmail.com added the comment: done in r73946, r73947 (2.6), r73948 (py3k), r73949 (3.1) Thanks ! (also, the build_ext module is now perfectly similar between 2.x and 3.x) -- status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6459 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6459] distutils.command.build_ext.get_export_symbols should use the PyInit prefix rather then init
Hirokazu Yamamoto ocean-c...@m2.ccsnet.ne.jp added the comment: Well, I'm not sure but for example, Modules/_randomemodule.c uses init_random on trunk. Is it OK to use PyInit on trunk too? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6459 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6459] distutils.command.build_ext.get_export_symbols should use the PyInit prefix rather then init
Tarek Ziadé ziade.ta...@gmail.com added the comment: What's the logic behind PyInit_ ? For instance Modules/_bsddb.c uses PyInit, so does Modules/zlibmodule.c -- status: closed - open ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6459 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6459] distutils.command.build_ext.get_export_symbols should use the PyInit prefix rather then init
Hirokazu Yamamoto ocean-c...@m2.ccsnet.ne.jp added the comment: bsddb seems to use #if directive to switch function name. (init_bsddb on trunk) #if (PY_VERSION_HEX 0x0300) DL_EXPORT(void) init_bsddb(void) #else PyMODINIT_FUNC PyInit__bsddb(void)/* Note the two underscores */ #endif And zlibmodule.c, there is following line on line number 56. #define PyInit_zlib initzlib -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6459 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3982] support .format for bytes
Arjen Nienhuis a.g.nienh...@gmail.com added the comment: There are many binary formats that use ASCII numbers. 'HTTP chunking' uses ASCII mixed with binary (octets). With 2.6 you could write: def chunk(block): return b'{0:x}\r\n{1}\r\n'.format(len(block), block) With 3.0 you'd have to write this: def chunk(block): return format(len(block), 'x').encode('ascii') + b'\r\n' + block + b'\r\n' You cannot convert to ascii at the end of the pipeline as there are bytes 127 in the data blocks. -- nosy: +arjennienhuis ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3982 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6460] test failure in test_xmlrpc on Gentoo in trunk
R. David Murray rdmur...@bitdance.com added the comment: OK, the test passes on my box now. But from the way the test is phrased it sounds like there is still a small risk that the test will fail in unusual timing circumstances? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6460 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3982] support .format for bytes
Martin v. Löwis mar...@v.loewis.de added the comment: def chunk(block): return format(len(block), 'x').encode('ascii') + b'\r\n' + block + b'\r\n' You cannot convert to ascii at the end of the pipeline as there are bytes 127 in the data blocks. I wouldn't write it in such a complicated way. Instead, use def chunk(block): return hex(len(block)).encode('ascii') + b'\r\n' + block + b'\r\n' This doesn't need any format call, and describes adequatly how the protocol works: send an ASCII-encoded hex length, send CRLF, send the block, then send another CRLF. Of course, I would probably write that into the socket right away, rather than copying it into a different bytes object first. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3982 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6460] test failure in test_xmlrpc on Gentoo in trunk
R. David Murray rdmur...@bitdance.com added the comment: By the way, although my system doesn't show it, the Gentoo 3.x buildbot shows the error. I'm sure you were going to forward port the patch anyway :) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6460 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3982] support .format for bytes
Arjen Nienhuis a.g.nienh...@gmail.com added the comment: def chunk(block): return hex(len(block)).encode('ascii') + b'\r\n' + block + b'\r\n' hex(10) returns '0xa' instead of 'a'. This doesn't need any format call, and describes adequatly how the protocol works: send an ASCII-encoded hex length, send CRLF, send the block, then send another CRLF. Of course, I would probably write that into the socket right away, rather than copying it into a different bytes object first. The point is that need to convert to ascii for each int that you send. You cannot just wrap the socket with an encoding. This makes porting difficult. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3982 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6462] bsddb3 intermittent test failures
New submission from R. David Murray rdmur...@bitdance.com: The buildbots periodically report failures in the bsddb3 test suite. These are not reproducible and presumably are timing-based. It would be best if the tests could be made to pass consistently, to make the buildbot output more useful. Here is one such failure that I see on a semi-regular basis on trunk (this happens in my own tests runs as well, also not consistently): test_bsddb3 Berkeley DB 4.7.25: (June 30, 2009) Test path prefix: /tmp/z-test_bsddb3-11362 test test_bsddb3 failed -- Traceback (most recent call last): File /home/rdmurray/python/trunk/Lib/bsddb/test/test_replication.py, line 134, in test01_basic_replication self.assertTrue(time.time()timeout) AssertionError: False is not True I will add others here as I capture examples. -- assignee: jcea components: Tests messages: 90426 nosy: jcea, r.david.murray priority: normal severity: normal stage: needs patch status: open title: bsddb3 intermittent test failures type: behavior versions: Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6462 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1921] Confusing Descrintro example
Guido van Rossum gu...@python.org added the comment: I'm guessing you weren't ready for learning about metaclasses if you didn't get the fact that 'name' was the loop control variable in the two different loops. The example is only 11 lines long! Still, I'm fine with the two suggested renames. I'm not fine with rewriting the example using modern constructs, since it is part of the docs for Python 2.2. Perhaps the doc is still useful but then it should be first moved into the regular doc tree and *then* adapted to modern times (and we can't really release that version until 2.7 and 3.2 are released). Unfortunately I do not have a checkout of the website handy any more (or I can't remember where I put it). Maybe one of the webmasters can make the suggested fixes? The fixed code that I agree with is: class autoprop(type): def __init__(cls, name, bases, dict): super(autoprop, cls).__init__(name, bases, dict) props = {} for member in dict.keys(): if member.startswith(_get_) or member.startswith(_set_): props[member[5:]] = 1 for prop in props.keys(): fget = getattr(cls, _get_%s % prop, None) fset = getattr(cls, _set_%s % prop, None) setattr(cls, prop, property(fget, fset)) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1921 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3982] support .format for bytes
Martin v. Löwis mar...@v.loewis.de added the comment: hex(10) returns '0xa' instead of 'a'. Ah, right. So I would still use '{0:x}'.format(100).encode(ascii) rather than the format builtin format function. Actually, I would probably use ('%x' % len(bytes)).encode(ascii) The point is that need to convert to ascii for each int that you send. You cannot just wrap the socket with an encoding. This makes porting difficult. This I don't understand. What porting becomes more difficult? From 2.x to 3.x? Why do you have any .format calls in your code that you want to port - .format was only added in 2.6, so if you want to support 2.x, you surely are not using .format, are you? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3982 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6459] distutils.command.build_ext.get_export_symbols should use the PyInit prefix rather then init
Georg Brandl ge...@python.org added the comment: The PyInit_ prefix is only to be used in Python 3, it is part of PEP 3121. Please revert changes to trunk/2.6 that assume the PyInit_ name. -- nosy: +georg.brandl ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6459 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6459] distutils.command.build_ext.get_export_symbols should use the PyInit prefix rather then init
Tarek Ziadé ziade.ta...@gmail.com added the comment: Thanks for the explanation, I've reverted the change on 2.x. -- status: open - closed versions: -Python 2.6, Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6459 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6463] IDLE with Tk-Cocoa: Edit, format menus hang
New submission from Kevin Walzer wordt...@users.sourceforge.net: In running IDLE against a build of Tk-Cocoa (8.5.7) on OS X, the edit and format menus sometimes hang and require a force-quit of IDLE. This happens when I try to paste text, and also when trying to format selections of text with indentation, etc. I've looked closely at the code for Bindings.py, EditorWindow.py, PyShell.py, and macOSXSupport.py, and can find no obvious reason for these problems. I am confident that the problem is not with Tk-Cocoa itself, as copy, pasting, etc. in a basic Tkinter text widget presents no problems, but resides instead somewhere in IDLE's code and how it interacts with the Tk-Cocoa build. I'm testing against Python 2.6.2. -- components: IDLE messages: 90431 nosy: wordtech severity: normal status: open title: IDLE with Tk-Cocoa: Edit, format menus hang type: behavior versions: Python 2.6 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6463 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6464] test_normalization failures due to truncated NormalizationTest.txt file
New submission from R. David Murray rdmur...@bitdance.com: I worked for a while tracking down a mysterious failure in test_normalization on my machine. I eventually discovered that a clean checkout did not exhibit the problem. A distclean on my original checkout did not fix the problem. By doing a diff I finally figured out that the NormalizationTest.txt file is (a) downloaded the first time the test is run and (b) not removed afterward and (c) not removed by distclean. How I wound up with a truncated file I don't know, nor am I quite sure what the best solution to this little confusion is. It seems very odd that a file is dumped and left in the CWD by a test. -- components: Tests keywords: easy messages: 90432 nosy: r.david.murray priority: low severity: normal stage: needs patch status: open title: test_normalization failures due to truncated NormalizationTest.txt file type: behavior versions: Python 2.7, Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6464 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6464] test_normalization failures due to truncated NormalizationTest.txt file
Changes by R. David Murray rdmur...@bitdance.com: -- nosy: +lemburg, loewis ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6464 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6440] 2to3: convert deprecated string.maketrans to str.maketrans
Changes by Benjamin Peterson benja...@python.org: -- resolution: - rejected ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6440 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6465] email.feedparser regular expression bug (NLCRE_crack)
New submission from jkg pyt...@slashbot.com: If the parser is fed a chunk which ends with '\r' and the next chunk begins with '\n', it incorrectly parses this into a line ending with '\r' and an empty line ending with '\n' instead of a single line ending with '\r\n'. Test attached. Patch to follow. -- components: Library (Lib) files: test_nlcre.py messages: 90433 nosy: barry, jkg, tony_nelson severity: normal status: open title: email.feedparser regular expression bug (NLCRE_crack) type: behavior versions: Python 2.4, Python 2.5, Python 2.6, Python 2.7, Python 3.0, Python 3.1 Added file: http://bugs.python.org/file14484/test_nlcre.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6465 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6465] email.feedparser regular expression bug (NLCRE_crack)
jkg pyt...@slashbot.com added the comment: Patch. -- keywords: +patch Added file: http://bugs.python.org/file14485/nlcre.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6465 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6460] test failure in test_xmlrpc on Gentoo in trunk
Kristján Valur Jónsson krist...@ccpgames.com added the comment: No, this should take care of it. In order for the client side request to succeed, the server must have cycled through the previous request and updated its statistic. It is only the statistic for the final request tha t may be missed. And yes, I was going to fw. port, I was waiting for your confirmation. Cheers. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6460 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6460] test failure in test_xmlrpc on Gentoo in trunk
Kristján Valur Jónsson krist...@ccpgames.com added the comment: merged testsuite fix to py3k in revision 73961 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6460 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1921] Confusing Descrintro example
Benjamin Peterson benja...@python.org added the comment: I've now updated the website to Guido's new code. -- nosy: +benjamin.peterson resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1921 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6464] test_normalization failures due to truncated NormalizationTest.txt file
R. David Murray rdmur...@bitdance.com added the comment: Benjamin fixed this in r73962 by having the test support routine put the files in Lib/test/data, and adding a rule to the distclean target to empty that directory. -- nosy: +benjamin.peterson status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6464 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6464] test_normalization failures due to truncated NormalizationTest.txt file
Changes by Benjamin Peterson benja...@python.org: -- resolution: - fixed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6464 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com