Wing IDE 4.1.3 released
Hi, Wingware has released version 4.1.3 of Wing IDE, an integrated development environment designed specifically for the Python programming language. Wing IDE is a cross-platform Python IDE that provides a professional code editor with vi, emacs, and other key bindings, auto-completion, call tips, refactoring, context-aware auto-editing, a powerful graphical debugger, version control, unit testing, search, and many other features. **Changes in Version 4.1.3** Highlights of this release include: * Added move-line-up and move-line-down line editing commands * Added Open From Project option to search only on the file name * Added goto-overridden-method command * Added copy-reference command to copy filename, line number(s), scope, and optionally the current or selected lines to the clipboard * Added experimental Eclipse style key binding * Several auto-editing improvements * 12 vi mode fixes * Avoid grouping snippets and arg entry into a single undo action * Speed up auto-completion and auto-editing * About 25 other bug fixes and minor improvements Complete change log: http://wingware.com/pub/wingide/4.1.3/CHANGELOG.txt **New Features in Version 4** Version 4 adds the following new major features: * Refactoring -- Rename/move symbols, extract to function/method, and introduce variable * Find Uses -- Find all points of use of a symbol * Auto-Editing -- Reduce typing burden by auto-entering expected code * Diff/Merge -- Graphical file and repository comparison and merge * Django Support -- Debug Django templates, run Django unit tests, and more * matplotlib Support -- Maintains live-updating plots in shell and debugger * Simplified Licensing -- Includes all OSes and adds Support+Upgrades subscriptions Details on licensing changes: http://wingware.com/news/2011-02-16 **About Wing IDE** Wing IDE is an integrated development environment designed specifically for the Python programming language. It provides powerful editing, testing, and debugging features that help reduce development and debugging time, cut down on coding errors, and make it easier to understand and navigate Python code. Wing IDE can be used to develop Python code for web, GUI, and embedded scripting applications. Wing IDE is available in three product levels: Wing IDE Professional is the full-featured Python IDE, Wing IDE Personal offers a reduced feature set at a low price, and Wing IDE 101 is a free simplified version designed for teaching beginning programming courses with Python. Version 4.0 of Wing IDE Professional includes the following major features: * Professional quality code editor with vi, emacs, and other keyboard personalities * Code intelligence for Python: Auto-completion, call tips, find uses, goto-definition, error indicators, refactoring, context-aware auto-editing, smart indent and rewrapping, and source navigation * Advanced multi-threaded debugger with graphical UI, command line interaction, conditional breakpoints, data value tooltips over code, watch tool, and externally launched and remote debugging * Powerful search and replace options including keyboard driven and graphical UIs, multi-file, wild card, and regular expression search and replace * Version control integration for Subversion, CVS, Bazaar, git, Mercurial, and Perforce * Integrated unit testing with unittest, nose, and doctest frameworks * Django support: Debugs Django templates, provides project setup tools, and runs Django unit tests * Many other features including project manager, bookmarks, code snippets, diff/merge tool, OS command integration, indentation manager, PyLint integration, and perspectives * Extremely configurable and may be extended with Python scripts * Extensive product documentation and How-Tos for Django, matplotlib, Plone, wxPython, PyQt, mod_wsgi, Autodesk Maya, and many other frameworks Please refer to http://wingware.com/wingide/features for a detailed listing of features by product level. System requirements are Windows 2000 or later, OS X 10.3.9 or later (requires X11 Server), or a recent Linux system (either 32 or 64 bit). Wing IDE supports Python versions 2.0.x through 3.2.x and Stackless Python. For more information, see the http://wingware.com/ **Downloads** Wing IDE Professional and Wing IDE Personal are commercial software and require a license to run. A free trial can be obtained directly from the product when launched. Wing IDE Pro -- Full-featured product: http://wingware.com/downloads/wingide/4.1 Wing IDE Personal -- A simplified IDE: http://wingware.com/downloads/wingide-personal/4.1 Wing IDE 101 -- For teaching with Python: http://wingware.com/downloads/wingide-101/4.1 **Purchasing and Upgrading** Wing 4.x requires an upgrade for Wing IDE 2.x and 3.x users at a cost of 1/2 the full product pricing. Upgrade a license: https://wingware.com/store/upgrade Purchase a new license: https://wingware.com/store/purchase Optional
ANN: pysendfile 0.2.0 released
Hi folks, I'm pleased to announce the 0.2.0 release of pysendfile: http://code.google.com/p/pysendfile === About === This is a python interface to sendfile(2) system call available on most UNIX systems. sendfile(2) provides a zero-copy way of copying data from one file descriptor to another (a socket). The phrase zero-copy refers to the fact that all of the copying of data between the two descriptors is done entirely by the kernel, with no copying of data into userspace buffers, resuting in file transfers being from 2x to 3x faster. Basically, any application sending files over the network can take advantage of it. HTTP and FTP servers are a typical example. === Supported platforms === * Linux * Mac OSX * FreeBSD * Dragon Fly BSD * Sun OS * AIX (not properly tested) === Supported python versions === From 2.5 to 3.3. === Links === * Home page: http://code.google.com/p/pysendfile * Source tarball: http://pysendfile.googlecode.com/files/pysendfile-0.2.0.tar.gz --- Giampaolo Rodola' http://code.google.com/p/pyftpdlib/ http://code.google.com/p/psutil/ http://code.google.com/p/pysendfile/ -- http://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations/
SQLAlchemy and Camelot Trainings in Germany
Get up to Speed with SQLAlchemy and More SQLAlchemy is a great library that combines the power of Python with the well-establish world of relational databases in a powerful manner. If you would like to learn more about SQLAlchemy, you might be interested in our course in Germany. This course is followed by a Camelot course. Camelot uses SQLAlchemy for building rich desktop applications. If you would like to improve your Python knowledge before taking these courses, we recommend our Python for Programmers course that you can attend just before the SQLAlchemy course. All three courses can be booked separately or combined. See below for details. Mike SQLAlchemy Course - One-day in-depth SQLAlchemy training with guest trainer Erik Janssens. Date: 09.02.2012 Location: Leipzig, Germany Trainer: Erik Janssens Course Language: English Link: http://www.python-academy.com/courses/specialtopics/python_course_sqlalchemy.html Camelot Course -- Camelot (http://www.python-camelot.com/) is an open source RAD framework for rich desktop applications. Basic ingredients are Python, SQLAlchemy and Qt. This course is best combined with the SQLAlchemy course just the day before (see above). The course is presented by guest trainer and Camelot expert Erik Janssens. Date: 10.02.2012 Location: Leipzig, Germany Trainer: Erik Janssens Course Language: English Link: http://www.python-academy.com/courses/specialtopics/python_course_camelot.html Python for Programmers -- You know another programming language and would like to learn Python? This course teaches you all the basics to write useful Python programs. It is hands-on with plenty of exercises and also provides sound knowledge how Python does things. Date: 06.02.-08.02.2012 Location: Leipzig, Germany Trainer: Mike Müller Course Language: English Link: http://www.python-academy.com/courses/python_course_programmers.html -- http://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations/
Re: Zealotry [was Re: how to install lxml in window xp?]
On Fri, Jan 13, 2012 at 4:41 PM, alex23 wuwe...@gmail.com wrote: Oh please. Don't tar me with the Windows brush. Wouldn't the Windows brush zip you instead? ChrisA definitely ready for the weekend now -- http://mail.python.org/mailman/listinfo/python-list
Re: Zealotry [was Re: how to install lxml in window xp?] (OT)
Noah Hall, 13.01.2012 08:29: I'M SO COOL USE MY HARDCORE GENTOO INSTALL THAT TOOK 36 HOURS AND SHAVED 2 SECONDS OFF MY BOOTUP TIME Just an off-topic thing that your comment above reminded me of: has anyone ever noticed that there are even quick install guides for Gentoo Linux? I think that's funny. Stefan -- http://mail.python.org/mailman/listinfo/python-list
Re: Zealotry [was Re: how to install lxml in window xp?] (OT)
On Fri, Jan 13, 2012 at 7:54 AM, Stefan Behnel stefan...@behnel.de wrote: Noah Hall, 13.01.2012 08:29: I'M SO COOL USE MY HARDCORE GENTOO INSTALL THAT TOOK 36 HOURS AND SHAVED 2 SECONDS OFF MY BOOTUP TIME Just an off-topic thing that your comment above reminded me of: has anyone ever noticed that there are even quick install guides for Gentoo Linux? Gentoo Linux - for when life's just too simple. -- http://mail.python.org/mailman/listinfo/python-list
Re: Zealotry
Ben Finney wrote: Steven D'Aprano steve+comp.lang.pyt...@pearwood.info writes: On Thu, 12 Jan 2012 18:50:13 -0800, alex23 wrote: Tamer Higazi th9...@googlemail.com wrote: So, instead of making yourself continuously headache for an outdated OS I advise [...] Please don't recommend people use another OS when they ask an explicit question about a particular OS. It just makes you come across as a zealot. Why is it that only Linux and Mac users are accused of being zealots? If I ask how to install (say) MYOB or Photoshop on Linux, and people tell me that I will have to use Windows if I want to easily run that software, I don't accuse them of being a zealot. Agreed. Giving a recommendation for a different OS is not zealotry. Even if it were expressed passionately (and I don't think this case qualifies), a recommendation of software on its merits is still not zealotry. When someone starts being extremely emotional, or even militant, it might be appropriate to break out the “zealot” label. Short of that, it's an attempt to slur someone enthusiastically giving advice. Recommending an OS to solve one python package installation is zealotry. At least, advise to use a virtual machine software to try it out, there are some VM softwares for free working with windows. JM -- http://mail.python.org/mailman/listinfo/python-list
Re: Zealotry
On Fri, Jan 13, 2012 at 9:34 PM, Jean-Michel Pichavant jeanmic...@sequans.com wrote: Recommending an OS to solve one python package installation is zealotry. At least, advise to use a virtual machine software to try it out, there are some VM softwares for free working with windows. If I recommend Python to someone, I don't (usually) care whether he runs it under Windows or Linux. If I recommend the use of a computer, I don't care whether he runs it on 220V or 110V. A virtual machine doesn't have anything to do with the issue, and install Debian doesn't specify _where_. He could replace his Windows, use a virtualizer, or buy a brand new box for it - makes no diff. ChrisA -- http://mail.python.org/mailman/listinfo/python-list
Re: Zealotry [was Re: how to install lxml in window xp?]
On Thu, 12 Jan 2012 21:41:29 -0800, alex23 wrote: On Jan 13, 3:02 pm, Steven D'Aprano steve +comp.lang.pyt...@pearwood.info wrote: Why is it that only Linux and Mac users are accused of being zealots? Oh please. Don't tar me with the Windows brush. I'd have used the same term no matter what OS was being recommended. I didn't tar you with anything, let alone being a Windows fan-boy. I took great care to avoid making any accusations about you. Perhaps you're a tad over-sensitive? If I ask how to install (say) MYOB or Photoshop on Linux, and people tell me that I will have to use Windows if I want to easily run that software, I don't accuse them of being a zealot. And if lxml didn't have Windows binaries, then maybe this would be the case. The Original Poster was attempting to build lxml binaries under XP. Apparently this is difficult enough that the best answer anyone can give is download some pre-built binary from some guy on the Internet, and hope it is up to date and works. (I'm paraphrasing from memory.) It isn't clear to me whether the OP doesn't give a monkey's toss where the binaries come from so long as they get installed, or whether he is hoping to build them himself (for fun, for education, because he doesn't trust some guy on the Internet). If the second case, then download binaries is no more helpful than INSTALL LINUX!!! would be. [snippety snippety to the rest of your straw men] I really get frustrated by people who use straw man as a meaningless term of abuse for any argument they don't like or disagree with. Straw man argument has a specific meaning, and it doesn't apply to what I wrote: I did not attack a weakened or extreme version of your argument, but made a complaint about the double standards in accusations of zealotry. If you want to accuse me of anything, it is use of weasel words like some Windows users [citation required]. But not straw man. That may be true, but the advice remains reasonable advice. If somebody asks you how to get from Iceland to Norway by car, it is perfectly reasonable to tell them that they will find it much easier to use a plane or boat. In what way is downloading pre-built binaries and then installing lxml on Windows like driving across the ocean? Now *there's* a straw man. It is *building* the binaries under XP that are like driving across the ocean: difficult enough that the best advice given is leave it to someone else. This is a new low in pedantry for you. And misuse of the word pedantry too, tsk tsk. wink Some Windows users are so used to being the centre of the computing universe that any time they hit a problem that is easier to solve on another OS, and people dare remind them of that fact, they get their nose out of joint. Because suggesting people ditch their environment whenever they hit a single bit of friction - whether it's one they've chosen or had forced upon them - is absolutely ridiculous. Perhaps. It depends on how important the task is, and how much friction is there. If the task is important enough, and the friction great enough, then it isn't ridiculous at all. My wife ditched KDE 4 as her desktop due to a single point of friction: the inability to get Bluetooth working correctly. And believe me, _no_ user of Windows' Python would ever make the mistake of thinking they were the centre of _that_ world. Oh I don't know, I long ago have ceased to be surprised by the narcissism of some computer users. Recommending another OS to a clearly phrased problem is the IT equivalent of the old joke about the doctor saying well don't do that then. It doesn't do _anything_ to address the actual problem the person is trying to solve. On the contrary, it prevents the symptoms of the problem, which very often is good enough, or even the best that can be done. Look, I'm not and never did defend the *specific* argument that upgrading to Windows 7 or cross-grading to Gentoo Linux was the right solution for the failure to compile lxml under Windows XP. I've never tried to compile lxml at all, and for all I know, it might be *more difficult* under Linux than Windows. (Stranger things have happened.) I'm just making a point about perceptions of zealotry. -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: copy on write
El 13/01/12 11:33, Eduardo Suarez-Santana escribió: I wonder whether this is normal behaviour. Even simpler: $ python Python 2.7.2 (default, Oct 31 2011, 11:54:55) [GCC 4.5.3] on linux2 Type help, copyright, credits or license for more information. r={'a':1}; d={}; d['x']=r; d['y']=r; d['x']['a']=3 d['y'] {'a': 3} -- http://mail.python.org/mailman/listinfo/python-list
copy on write
I wonder whether this is normal behaviour. I would expect equal sign to copy values from right to left. However, it seems there is a copy-on-write mechanism that is not working. Anyone can explain and provide a working example? Thanks, -Eduardo $ python Python 2.7.2 (default, Oct 31 2011, 11:54:55) [GCC 4.5.3] on linux2 Type help, copyright, credits or license for more information. class n: ... def __init__(self, id, cont): ... self.id = id; ... self.cont = cont; ... r={'a':1}; d={}; d['x']=r; d['y']=r; x1 = n('x',d['x']); y1 = n('y',d['y']); x1.cont['a']=2; y1.cont {'a': 2} -- http://mail.python.org/mailman/listinfo/python-list
Re: copy on write
Eduardo Suarez-Santana wrote: El 13/01/12 11:33, Eduardo Suarez-Santana escribió: I wonder whether this is normal behaviour. Even simpler: $ python Python 2.7.2 (default, Oct 31 2011, 11:54:55) [GCC 4.5.3] on linux2 Type help, copyright, credits or license for more information. r={'a':1}; d={}; d['x']=r; d['y']=r; d['x']['a']=3 d['y'] {'a': 3} yes it is. d['x']=r; d['y']=r; means that both d['x'] and d['y'] name the same object r. If you change r, you'll see these changes wheter using d['x'] or d['y']. The operator '=' does not copy objects, it binds an object to a name, and an object can have multiple names. Use the dictionary copy method to copy a dictionary: d['x'] = r.copy() JM -- http://mail.python.org/mailman/listinfo/python-list
Re: Zealotry
Chris Angelico wrote: On Fri, Jan 13, 2012 at 9:34 PM, Jean-Michel Pichavant jeanmic...@sequans.com wrote: Recommending an OS to solve one python package installation is zealotry. At least, advise to use a virtual machine software to try it out, there are some VM softwares for free working with windows. If I recommend Python to someone, I don't (usually) care whether he runs it under Windows or Linux. If I recommend the use of a computer, I don't care whether he runs it on 220V or 110V. A virtual machine doesn't have anything to do with the issue, and install Debian doesn't specify _where_. He could replace his Windows, use a virtualizer, or buy a brand new box for it - makes no diff. ChrisA People may not know that they can have multiple OS on the same machine, that lowers the cost a lot, that's all I was saying. JM -- http://mail.python.org/mailman/listinfo/python-list
Re: copy on write
On Fri, 13 Jan 2012 11:33:24 +, Eduardo Suarez-Santana wrote: I wonder whether this is normal behaviour. I would expect equal sign to copy values from right to left. Assignment in Python never copies values. However, it seems there is a copy-on-write mechanism that is not working. There is no copy-on-write. Assignment in Python is name binding: the name on the left hand side is bound to the object on the right. An object can have zero, one or many names. If the object is mutable, changes to the object will be visible via any name: x = [] # lists are mutable objects y = x # not a copy of x, but x and y point to the same object x.append(42) # mutates the object in place print y [42] The same rules apply not just to names, but also to list items and dict items, as well as attributes, and any other reference: z = [x, y] # z is a list containing the same sublist twice z[0].append(23) print z [[42, 23], [42, 23]] When you work with floats, ints or strings, you don't notice this because those types are immutable: you can't modify those objects in place. So for example: a = 42 # binds the name 'a' to the object 42 b = a # a and b point to the same object a += 1 # creates a new object, and binds it to a print b # leaving b still pointing to the old object 42 -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: copy on write
On Fri, Jan 13, 2012 at 11:10 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: z = [x, y] # z is a list containing the same sublist twice z[0].append(23) print z [[42, 23], [42, 23]] When you work with floats, ints or strings, you don't notice this because those types are immutable: you can't modify those objects in place. So for example: a = 42 # binds the name 'a' to the object 42 b = a # a and b point to the same object a += 1 # creates a new object, and binds it to a print b # leaving b still pointing to the old object 42 I was about to say that it's a difference between .append() which is a method on the object, and += which is normally a rebinding, but unfortunately: a=[] b=a a+=[1] a [1] b [1] b+=[2] a [1, 2] a [1, 2] a=a+[3] a [1, 2, 3] b [1, 2] (tested in Python 3.2 on Windows) It seems there's a distinct difference between a+=b (in-place addition/concatenation) and a=a+b (always rebinding), which is sorely confusing to C programmers. But then, there's a lot about Python that's sorely confusing to C programmers. ChrisA -- http://mail.python.org/mailman/listinfo/python-list
Re: copy on write
On Fri, 13 Jan 2012 23:30:56 +1100, Chris Angelico wrote: It seems there's a distinct difference between a+=b (in-place addition/concatenation) and a=a+b (always rebinding), Actually, both are always rebinding. It just happens that sometimes a+=b rebinds to the same object that it was originally bound to. In the case of ints, a+=b creates a new object (a+b) and rebinds a to it. In the case of lists, a+=b nominally creates a list a+b, but in fact it implements that as an in-place operation a.extend(b), and then rebinds the name a to the list already bound to a. It does that because the Python VM doesn't know at compile time whether a+=b will be in-place or not, and so it has to do the rebinding in order to support the fall-back case of a+=b = a=a+b. Or something -- go read the PEP if you really care :) Normally this is harmless, but there is one interesting little glitch you can get: t = ('a', [23]) t[1] += [42] Traceback (most recent call last): File stdin, line 1, in module TypeError: 'tuple' object does not support item assignment t ('a', [23, 42]) which is sorely confusing to C programmers. But then, there's a lot about Python that's sorely confusing to C programmers. I prefer to think of it as there's a lot about C that is sorely confusing to anyone who isn't a C programmer wink -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: [Python-ideas] Symbolic expressions (or: partials and closures from the inside out)
On Thu, Jan 12, 2012 at 3:45 PM, Nathan Rice nathan.alexander.r...@gmail.com wrote: I'm interested in fixing both issues. I believe both issues I've had could be solved by having a robust symbolic object. These objects would basically usable like ordinary objects, however upon any attribute access or other form of interaction, the object would basically short circuit the calling function, and return a symbolic object directly to the outer scope. The symbolic object would behave like a generator function frozen at the point of attribute access, and upon send()-ing (or whatever method), it would behave exactly as if the values sent had been the ones passed in originally (ideally without consuming the generator). I find the way you've formalized this a bit weird. It looks like you're suggesting adding laziness to Python. If that's what you want, maybe you should try PyPy and the thunk object space: http://doc.pypy.org/en/latest/objspace-proxies.html#the-thunk-object-space -- Devin -- http://mail.python.org/mailman/listinfo/python-list
Re: copy on write
On Fri, Jan 13, 2012 at 7:30 AM, Chris Angelico ros...@gmail.com wrote: It seems there's a distinct difference between a+=b (in-place addition/concatenation) and a=a+b (always rebinding), which is sorely confusing to C programmers. But then, there's a lot about Python that's sorely confusing to C programmers. I think this is confusing to just about everyone, when they first encounter it. -- Devin -- http://mail.python.org/mailman/listinfo/python-list
Re: ERROR:root:code for hash md5 was not found
On Jan 13, 5:41 am, alex23 wuwe...@gmail.com wrote: On Jan 13, 1:34 pm, Steven D'Aprano steve +comp.lang.pyt...@pearwood.info wrote: What is pysibelius? I can't find it on the web. Does it have anything to do with Sibelius the music composition software? Yes, please provide more information about the pysibelius package, especially if this is the case. The few tenuous Python/Sibelius links I found didn't have anything on pysibelius, unfortunately. Hi, pysibelius is a lib that we use. I am not sure that is the problem since the python program works on SuSE but not on RH server. And AFAIK the only difference ( well that I can see) is the OpenSSL version. According to code it uses openssl: built-in function openssl_md5 So I need to find a way to convince the linux sys admin to install same version of openssl on both servers. Thanks a lot for your valuable time. //mike -- http://mail.python.org/mailman/listinfo/python-list
Re: [Python-ideas] Symbolic expressions (or: partials and closures from the inside out)
On Fri, Jan 13, 2012 at 8:45 AM, Devin Jeanpierre jeanpierr...@gmail.com wrote: On Thu, Jan 12, 2012 at 3:45 PM, Nathan Rice nathan.alexander.r...@gmail.com wrote: I'm interested in fixing both issues. I believe both issues I've had could be solved by having a robust symbolic object. These objects would basically usable like ordinary objects, however upon any attribute access or other form of interaction, the object would basically short circuit the calling function, and return a symbolic object directly to the outer scope. The symbolic object would behave like a generator function frozen at the point of attribute access, and upon send()-ing (or whatever method), it would behave exactly as if the values sent had been the ones passed in originally (ideally without consuming the generator). I find the way you've formalized this a bit weird. It looks like you're suggesting adding laziness to Python. If that's what you want, maybe you should try PyPy and the thunk object space: While thunk is neat, it doesn't accomplish precisely what I'm describing in this instance. When a function starts to run under thunk, the computations take place as soon as the function gets to the object inside its scope. What I'm after is the ability to basically create functions using only expressions, in a generative manner. Lambda does accomplish this, but in an extremely clunky manner... for example: X = lambda x: x + 1 Y = lambda y: y * 2 Z = lambda z: z % 3 (or XYZ = lambda x: (((x + 1) * 2) % 3) If I want to perform a second step after this, I need create another lambda, because they don't chain/aren't generative. The thing that Elementwise does that is very appealing is that most operations are generative, so if you have an ElementwiseProxy object x, x2 = (((x + 1) * 2) % 3) basically does the same thing as the above, but you can then do x3 = x2 ** 3, and so on until you are ready to get your results. Once you have your results, you can use the same ElementwiseProxy again with different inputs. It is just a function generation technique which has some elegant properties. Having a native object type designed to facilitate this would let people do a lot of interesting things, and make things like Elementwise be a lot more consistent. I bet you could do some really neat things by subclassing such an object as well. This is certainly not a common programming paradigm, but I think most people could reap a lot of benefits from it while being oblivious to its presence. Nathan -- http://mail.python.org/mailman/listinfo/python-list
Re: Reading and writing to a file creates null characters
On Jan 12, 6:21 pm, MRAB pyt...@mrabarnett.plus.com wrote: On 12/01/2012 22:26, Denhua wrote: Hi, I've got a file which I'd like to read, modify and write. # file contents a b c d My script reads the file contents into a list and rotates the list and writes it back to the same file. Problem is that the output contains null characters. I don't know where they are coming from. #!/usr/bin/env python def rotate(l): return l[1:] + [l[0]] f = open(/tmp/.rrd, 'r+') lines = [ line.strip() for line in f.readlines() ] newlist = rotate(lines) print newlist f.truncate(0) f.write(\n.join(newlist)) f.close() # output [root@Inferno html]# python rotate.py ['b', 'c', 'd', 'a'] [root@Inferno html]# python rotate.py ['c', 'd', 'a', '\x00\x00\x00\x00\x00\x00\x00\x00b'] [root@Inferno html]# What's going on? Thanks for your help, I think this is the relevant part of the documentation: The current file position is not changed. Note that if a specified size exceeds the file’s current size, the result is platform-dependent: possibilities include that the file may remain unchanged, increase to the specified size as if zero-filled, or increase to the specified size with undefined new content. In other words, you also need to reset the file pointer to the start of the file. Great! I added the line: f.seek(0) and that solved the problem. Thanks to both of you for your help. Dennis P.s. I made assumptions about the truncate function. I assumed that since the truncate function was clearing the file therefore I assumed with nothing in the file that the file pointer would be at the first position. root@Inferno html]# python rotate.py ['b', 'c', 'd', 'a'] [root@Inferno html]# python rotate.py ['c', 'd', 'a', 'b'] [root@Inferno html]# python rotate.py ['d', 'a', 'b', 'c'] [root@Inferno html]# python rotate.py ['a', 'b', 'c', 'd'] [root@Inferno html]# python rotate.py ['b', 'c', 'd', 'a'] [root@Inferno html]# python rotate.py ['c', 'd', 'a', 'b'] [root@Inferno html]# python rotate.py ['d', 'a', 'b', 'c'] [root@Inferno html]# python rotate.py ['a', 'b', 'c', 'd'] [root@Inferno html]# python rotate.py ['b', 'c', 'd', 'a'] [root@Inferno html]# python rotate.py ['c', 'd', 'a', 'b'] [root@Inferno html]# python rotate.py ['d', 'a', 'b', 'c'] [root@Inferno html]# -- http://mail.python.org/mailman/listinfo/python-list
Re: copy on write
On 2012-01-13, Devin Jeanpierre jeanpierr...@gmail.com wrote: On Fri, Jan 13, 2012 at 7:30 AM, Chris Angelico ros...@gmail.com wrote: It seems there's a distinct difference between a+=b (in-place addition/concatenation) and a=a+b (always rebinding), which is sorely confusing to C programmers. But then, there's a lot about Python that's sorely confusing to C programmers. I think this is confusing to just about everyone, when they first encounter it. That depends on what languages they've used in the past and whether they skip reading any documentation and just assume that all languages work the same way. I would agree that for the majority of new users, they previously used only languages where an assignment operator does a copy value, and that 90+ percent of the time those new users they assume all languages work that way. I'm not sure what we can do about that -- Python's semantics are well documented. -- Grant Edwards grant.b.edwardsYow! If our behavior is at strict, we do not need fun! gmail.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Zealotry [was Re: how to install lxml in window xp?]
In 4f0fbad0$0$29984$c3e8da3$54964...@news.astraweb.com Steven D'Aprano steve+comp.lang.pyt...@pearwood.info writes: Why is it that only Linux and Mac users are accused of being zealots? Perhaps because Windows, being in a position of market dominance, doesn't *need* zealots. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, The Gashlycrumb Tinies -- http://mail.python.org/mailman/listinfo/python-list
Re: open office in another language?
I'm a somewhat-satisfied openoffice.org user. I mean it works, but if it weren't in Java I'd be doing some of my own tweaking. But since it's in Java I stay away... no likey. OpenOffice (now LibreOffice, btw.) is not implemented in Java, if that's what you mean. It _is_ scriptable in Python, however there doesn't seem to be any documentation available. Ask on the Libreoffice-users list. Has there been any talk of doing another similar office suite, or maybe just writer + spreadsheet, in a better language eg python? You wouldn't implement Office-style software entirely in Python. Other FOSS Office-style software apart from LibreOffice is, e.g. Abiword and GNUmeric. Both are scriptable in Python as well, iirc. And, of course, there's LyX (also scriptable in Python), which I do prefer a L-O-T over word processor applications for writing. And there is Pyspread. Sincerely, Wolfgang -- HOMO HOMINI HOSTISIN FELIBUS FELICITAS -- http://mail.python.org/mailman/listinfo/python-list
Re: open office in another language?
On Wed, Jan 11, 2012 at 00:17, Sean Wolfe ether@gmail.com wrote: hmm I didn't know this, nice to know. Yes, C++ is still enough overhead that I wouldn't want to try extending it ... I bet the code is a whole lot to try and grok. When Apache got the LibreOffice project they heavily refactored the code. As a result, LO is considered less of a monstrosity to hack on than Open Office. That said, if your goal is to try to extend an application, then being written in Java as opposed to C++ would be an advantage, not a disadvantage. Especially in an application the size of OOo. That said, only a few dialogues and wizards (none critical) are written in Java. Most is C++. It would be nice to have an office suite in a newer language that is easier to tinker with. Take a look at Calligra, C++ with Qt. It is supposed to be very easy to extend and port, in fact that was a design goal. http://calligra-suite.org/ -- Dotan Cohen http://what-is-what.com/what_is/python.html -- http://mail.python.org/mailman/listinfo/python-list
Re: open office in another language?
On 13 January 2012 17:39, Dotan Cohen dotanco...@gmail.com wrote: On Wed, Jan 11, 2012 at 00:17, Sean Wolfe ether@gmail.com wrote: hmm I didn't know this, nice to know. Yes, C++ is still enough overhead that I wouldn't want to try extending it ... I bet the code is a whole lot to try and grok. When Apache got the LibreOffice project they heavily refactored the code. As a result, LO is considered less of a monstrosity to hack on than Open Office. Once again, a nitpick. Apache did not get the LibreOffice project, but the Openoffice.org project from Oracle. LibreOffice is a fork of openoffice and a foundation independant from Apache. Work has been done to simplify the code, but I wouldn't say it is much better: they can do a limited amount of job with a limited amount of developpers (mostly old OOo devs). So yes, there are less comments written in german than there used to, but it is still a very old, buggy code in which changing a line causes lots of pain. That said, if your goal is to try to extend an application, then being written in Java as opposed to C++ would be an advantage, not a disadvantage. Especially in an application the size of OOo. That said, only a few dialogues and wizards (none critical) are written in Java. Most is C++. It would be nice to have an office suite in a newer language that is easier to tinker with. Take a look at Calligra, C++ with Qt. It is supposed to be very easy to extend and port, in fact that was a design goal. http://calligra-suite.org/ -- Dotan Cohen http://what-is-what.com/what_is/python.html -- http://mail.python.org/mailman/listinfo/python-list
Re: copy on write
On Fri, Jan 13, 2012 at 10:13 AM, Grant Edwards invalid@invalid.invalid wrote: On 2012-01-13, Devin Jeanpierre jeanpierr...@gmail.com wrote: On Fri, Jan 13, 2012 at 7:30 AM, Chris Angelico ros...@gmail.com wrote: It seems there's a distinct difference between a+=b (in-place addition/concatenation) and a=a+b (always rebinding), which is sorely confusing to C programmers. But then, there's a lot about Python that's sorely confusing to C programmers. I think this is confusing to just about everyone, when they first encounter it. That depends on what languages they've used in the past and whether they skip reading any documentation and just assume that all languages work the same way. I would agree that for the majority of new users, they previously used only languages where an assignment operator does a copy value, and that 90+ percent of the time those new users they assume all languages work that way. That isn't what I was referring to. Specifically, it confuses almost everyone the first time they encounter it that a += b is not the same as a = a + b. And sure, it's documented. That's a bit of a cop-out though... it isn't in the tutorial, and even if it were, it's not as if people remember everything they read. It's not about whether you _can_ know it as much as whether it is obvious. There's a bit of a feeling that code should do what it looks like and be sort of understandable without exactly understanding everything. Maybe this idea is wrong if taken to an extreme (since it's really impossible to do completely), but the feeling of it is probably decent. It's why we use + for addition and - for subtraction, and not the other way around. You don't need to know the details of operator overloading and NotImplemented and so on to get what X + Y means for numbers, or even for lists. I feel like a += b is sort of implicitly understood by most programmers to be the same as a = a + b. If you asked someone what it meant, their first answer would be Oh, it means a = a + b[*]. That is why it's confusing -- even to people that weren't already exposed to that idea that these are equivalent, they get infected fast. And then expectations get broken, because they're only *usually* equivalent. [*] Before posting this, I actually tried this on a Python IRC channel -- and it happened exactly as so. -- Devin -- http://mail.python.org/mailman/listinfo/python-list
Re: open office in another language?
On Fri, Jan 13, 2012 at 18:46, Nelle Varoquaux Once again, a nitpick. Apache did not get the LibreOffice project, but the Openoffice.org project from Oracle. LibreOffice is a fork of openoffice and a foundation independant from Apache. Work has been done to simplify the code, but I wouldn't say it is much better: they can do a limited amount of job with a limited amount of developpers (mostly old OOo devs). So yes, there are less comments written in german than there used to, but it is still a very old, buggy code in which changing a line causes lots of pain. Sorry, you are correct. Apache did refactor OOo in order to integrate it with Apache coding practices. LO is, however, heavily refactored from what I understand. Note that this may all be heresy, I've not looked at the code of either! -- Dotan Cohen http://gibberish.co.il http://what-is-what.com -- http://mail.python.org/mailman/listinfo/python-list
Re: copy on write
On 2012-01-13, Devin Jeanpierre jeanpierr...@gmail.com wrote: On Fri, Jan 13, 2012 at 10:13 AM, Grant Edwards invalid@invalid.invalid wrote: On 2012-01-13, Devin Jeanpierre jeanpierr...@gmail.com wrote: On Fri, Jan 13, 2012 at 7:30 AM, Chris Angelico ros...@gmail.com wrote: It seems there's a distinct difference between a+=b (in-place addition/concatenation) and a=a+b (always rebinding), which is sorely confusing to C programmers. But then, there's a lot about Python that's sorely confusing to C programmers. I think this is confusing to just about everyone, when they first encounter it. That depends on what languages they've used in the past and whether they skip reading any documentation and just assume that all languages work the same way. I would agree that for the majority of new users, they previously used only languages where an assignment operator does a copy value, and that 90+ percent of the time those new users they assume all languages work that way. That isn't what I was referring to. Specifically, it confuses almost everyone the first time they encounter it that a += b is not the same as a = a + b. If you've ever implemented operator=, operator+, and operator+= in C++ you'll know how and why they are different. A C++ programmer would be wondering how either can work on immutable objects, and that's where Python's magical rebinding semantics come into play. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list
Problem filling an html form
# get some enviromental values form = cgi.FieldStorage() mail = form.getvalue('mail') or '' comment = form.getvalue('comment') or '' # insert guest comments into database if form was submitted if '@' in mail and comment not in (Ρωτήστε με σχετικά...): try: cursor.execute( '''INSERT INTO users(mail, comment) VALUES(%s, %s)''', (mail, comment) ) except MySQLdb.Error, e: print ( Error %d: %s % (e.args[0], e.args[1]) ) print ( h2font color=blueΕυχαριστώ για την ερώτηση! Θα σας απαντήσω το συντομότερο δυνατό! ) sys.exit(0) else: print ( h2font color=redΣυμπλήρωσε σωστά το mail σου και δώσε το σχολιασμό σου! ) sys.exit(0) == In my webpage here http://superhost.gr/hosting.html i ask the users mail and comment in a html form. No matter what info the user gives after he submits the form, nothing else happens instead of reloading the page itself while what i want the code to do is to enter the if structure and display the appropriate message, depending if the user entered data in the imput box or not. Am i missing something here? -- http://mail.python.org/mailman/listinfo/python-list
Re: ERROR:root:code for hash md5 was not found
On 01/13/2012 07:14 AM, mike wrote: pysibelius is a lib that we use. I am not sure that is the problem since the python program works on SuSE but not on RH server. And AFAIK the only difference ( well that I can see) is the OpenSSL version. According to code it uses openssl: built-in function openssl_md5 So I need to find a way to convince the linux sys admin to install same version of openssl on both servers. Unfortunately that's going to be fairly difficult, as they would have to install a new version of openssl alongside the existing system version, which you can't just replace. Or it might be possible to copy the openssl libraries from SuSE over. Either way you will have to use the LD_LIBRARY_PATH or the LD_LIBRARY_PRELOAD environment variables to get PySibelius to load that version instead of the system one. -- http://mail.python.org/mailman/listinfo/python-list
Re: open office in another language?
Wolfgang Keller, 13.01.2012 17:22: I'm a somewhat-satisfied openoffice.org user. I mean it works, but if it weren't in Java I'd be doing some of my own tweaking. But since it's in Java I stay away... no likey. OpenOffice (now LibreOffice, btw.) is not implemented in Java, if that's what you mean. It _is_ scriptable in Python, however there doesn't seem to be any documentation available. Erm - care to take a look before making such a statement? http://www.openoffice.org/udk/python/python-bridge.html http://www.openoffice.org/udk/ Stefan -- http://mail.python.org/mailman/listinfo/python-list
Re: python philosophical question - strong vs duck typing
On 1/9/2012 2:45 AM, Robert Kern wrote: On 1/9/12 5:35 AM, John Nagle wrote: Python has some serious problems that preclude optimization. Basically, the language is designed to be run by a naive (non-optimizing) interpreter, and allows things that are easy for such an implementation but very tough to optimize. An example is the ability to store into the variables of a module from outside it, and even from another thread. Every attempt to get rid of the Global Interpreter Lock has hit that problem. You keep repeating this falsehood about the GIL. You have been repeatedly shown that this is false[1][2], though I have yet to see you acknowledge it. The GIL exists to protect Python's internal data structures, mostly the reference counts on objects. The reason that the attempts to remove the GIL from CPython have not been accepted is because they cause unacceptable performance losses in the common unthreaded case. In implementations of Python that do not use reference counting, there is no GIL. Neither Jython nor IronPython have a GIL, but they both have the standard Python semantics that let you store variables into modules from the outside, even from other threads. [1] http://mail.python.org/pipermail/python-list/2011-February/1265760.html [2] http://mail.python.org/pipermail/python-list/2011-April/1269056.html If you don't have a global lock, then you have to have lots of implicit locks, probably one on every symbol dictionary. IronPython does this well, though; their dictionaries do not require locking for read access, only for writes. So they avoid running up the overhead on routine symbol access. Some operations which CPython users assume are atomic, such as list append, are not atomic in IronPython. (See http://ironpython.codeplex.com/wikipage?title=FAQ;) The GIL does more than just protect memory allocation. If you want to retain the semantics of CPython, the implementation pretty much has to be slow. The Unladen Swallow project crashed and burned because of that fact. They couldn't even get 2x over CPython. There are still too many unnecessary dictionary lookups when running Python. Most of those could be optimized out at compile time if, when compiling a module, the compiler didn't have to worry about the module being altered from outside itself. John Nagle -- http://mail.python.org/mailman/listinfo/python-list
Re: copy on write
On 2012-01-13, Neil Cerutti ne...@norwich.edu wrote: If you've ever implemented operator=, operator+, and operator+= in C++ you'll know how and why they are different. That assumes that C++ programmers understand C++. ;) A C++ programmer would be wondering how either can work on immutable objects, and that's where Python's magical rebinding semantics come into play. -- Grant Edwards grant.b.edwardsYow! Thousands of days of at civilians ... have produced gmail.coma ... feeling for the aesthetic modules -- -- http://mail.python.org/mailman/listinfo/python-list
Re: copy on write
On Sat, Jan 14, 2012 at 5:15 AM, Grant Edwards invalid@invalid.invalid wrote: That assumes that C++ programmers understand C++. I understand C++ very well. That's why I use Python or Pike. (With apologies to Larry Wall) ChrisA -- http://mail.python.org/mailman/listinfo/python-list
Re: copy on write
On 2012-01-13, Chris Angelico ros...@gmail.com wrote: On Sat, Jan 14, 2012 at 5:15 AM, Grant Edwards invalid@invalid.invalid wrote: That assumes that C++ programmers understand C++. I understand C++ very well. That's why I use Python or Pike. (With apologies to Larry Wall) Were one inclined to troll a bit, one might be tempted to claim that using C++ is prima facie evidence of not understanding C++. Not that I would ever claim something inflamitory like that... -- Grant Edwards grant.b.edwardsYow! Thousands of days of at civilians ... have produced gmail.coma ... feeling for the aesthetic modules -- -- http://mail.python.org/mailman/listinfo/python-list
Re: Problem filling an html form
On 13/01/2012 17:02, Νικόλαος Κούρας wrote: # get some enviromental values form = cgi.FieldStorage() mail = form.getvalue('mail') or '' comment = form.getvalue('comment') or '' # insert guest comments into database if form was submitted if '@' in mail and comment not in (Ρωτήστε με σχετικά...): [snip] Do you really want to look for the comment in that string instead of looking for that string in the comment? -- http://mail.python.org/mailman/listinfo/python-list
Re: copy on write
Steven D'Aprano wrote: Normally this is harmless, but there is one interesting little glitch you can get: t = ('a', [23]) t[1] += [42] Traceback (most recent call last): File stdin, line 1, in module TypeError: 'tuple' object does not support item assignment t ('a', [23, 42]) There is one other glitch, and possibly my only complaint: -- a = [1, 2, 3] -- b = 'hello, world' -- a = a + b Traceback (most recent call last): File stdin, line 1, in module TypeError: can only concatenate list (not str) to list -- a += b -- a [1, 2, 3, 'h', 'e', 'l', 'l', 'o', ',', ' ', 'w', 'o', 'r', 'l', 'd'] IMO, either both + and += should succeed, or both should fail. ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list
NaN, Null, and Sorting
With NaN, it is possible to get a list that will not properly sort: -- NaN = float('nan') -- spam = [1, 2, NaN, 3, NaN, 4, 5, 7, NaN] -- sorted(spam) [1, 2, nan, 3, nan, 4, 5, 7, nan] I'm constructing a Null object with the semantics that if the returned object is Null, it's actual value is unknown. From a purist point of view if it is unknown then comparison results are also unknown since the actual value might be greater, lesser, or the same as the value being compared against. From a practical point of view a list with Nulls scattered throughout is a pain in the backside. So I am strongly leaning towards implementing the comparisons such that Null objects are less than other objects so they will always sort together. Thoughts/advice/criticisms/etc? ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list
Re: NaN, Null, and Sorting
On Sat, Jan 14, 2012 at 6:04 AM, Ethan Furman et...@stoneleaf.us wrote: So I am strongly leaning towards implementing the comparisons such that Null objects are less than other objects so they will always sort together. This is a perfectly plausible view, and is the one adopted by SQL (I'm pretty sure the NULLS FIRST / NULLS LAST clause is standard - you get to choose whether they're less than everything or more than everything). ChrisA -- http://mail.python.org/mailman/listinfo/python-list
Re: Zealotry [was Re: how to install lxml in window xp?]
dear people! I have just opened my MTU client, and figured out that through my comment, i caused a complete NONSENSE discussion at all. 1. I am not a zealot or whatever. I code on Linux and port it on MAC and WINDOWS. I do write solutions for customers across the whole 3 platform, and mostly I succeed because I have to figure out in advance which software (packages) are being supported and how far. 2. There are many open source projects out (don't ask where, look for yourself, you are old enough!) as well commercial software vendors who don't offer their products, or give support for Windows XP. 3. All of you know, that windows xp is by Microsoft not anymore supported. Neither with Security Updated, Enhancements with Software, SDK or whatever. and not only XP, also Win95,98,ME, and 2000 Professional (not the server editions). 4. Of course any OS has it's advantages and disadvantages. Gentoo is a rolling distribution, when it's set up it works nicely. Of course, you have to invest a lot of effort to get in what doesn't mean that Debian and Ubuntu, and the others are worse. Those who want to get packages maintained by others and love to get the System to run quickly is very good with the other distributions, and coding on those platforms make fun too. From my personal point of view, I will never set up a gentoo machine as a server in a datacenter, I would rather use BSD Unix. But this is something that personally everybody has to decide for him/herself. Now, I hope that I put a line under this discussions and beg the kids between the age of 18 - 24 who are really impulsive to fire around with the guns on others to stop this nonsense thread. That doesn't leave a nice picture in the community. PS: However, I will read the next mails in the list according this subject but I will stop commenting it, because it's getting for me too childish. Tamer Am 13.01.2012 16:32, schrieb John Gordon: In 4f0fbad0$0$29984$c3e8da3$54964...@news.astraweb.com Steven D'Aprano steve+comp.lang.pyt...@pearwood.info writes: Why is it that only Linux and Mac users are accused of being zealots? Perhaps because Windows, being in a position of market dominance, doesn't *need* zealots. -- http://mail.python.org/mailman/listinfo/python-list
Re: copy on write
On 2012-01-13, Grant Edwards invalid@invalid.invalid wrote: On 2012-01-13, Chris Angelico ros...@gmail.com wrote: On Sat, Jan 14, 2012 at 5:15 AM, Grant Edwards invalid@invalid.invalid wrote: That assumes that C++ programmers understand C++. I understand C++ very well. That's why I use Python or Pike. (With apologies to Larry Wall) Were one inclined to troll a bit, one might be tempted to claim that using C++ is prima facie evidence of not understanding C++. Not that I would ever claim something inflamitory like that... On the Python newsgroup, it's funny. ;) -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list
Re: Problem filling an html form
On 13 Ιαν, 21:35, MRAB pyt...@mrabarnett.plus.com wrote: On 13/01/2012 17:02, Íéêüëáïò Êïýñáò wrote: # get some enviromental values form = cgi.FieldStorage() mail = form.getvalue('mail') or '' comment = form.getvalue('comment') or '' # insert guest comments into database if form was submitted if '@' in mail and comment not in (ÑùôÞóôå ìå ó÷åôéêÜ...): [snip] Do you really want to look for the comment in that string instead of looking for that string in the comment? What do you mean? I just want to check that the user hasnt pressed the submit button leaving the default values with the input comment box. Iam not sure what you mean. -- http://mail.python.org/mailman/listinfo/python-list
Re: copy on write
On 01/13/2012 10:54 AM, Neil Cerutti wrote: If you've ever implemented operator=, operator+, and operator+= in C++ you'll know how and why they are different. At the same time, you'd also know that that implementing them in such a way that 'a += b' does *not* perform the same action as 'a = a + b' is considered very bad-mannered. In fact, it's often suggested (e.g. in More Effective C++'s Item 22, though this is not the main thrust of that section) to implement operator+ in terms of += to ensure that this is the case: MyType operator+ (MyType left, MyType right) { MyType copy = left; copy += right; return copy; } A C++ programmer would be wondering how either can work on immutable objects, and that's where Python's magical rebinding semantics come into play. IMO a C++ programmer wouldn't be likely to wonder that much at all because he or she wouldn't view the objects as immutable to begin with. :-) 'x = 5; x += 1;' makes perfect sense in C++, just for a somewhat different reason. Evan -- http://mail.python.org/mailman/listinfo/python-list
understanding a program project
Hi all, i hope not to be too much OT with this request. I'ld like to modify/contribute some open source in python, but first i've to read and understand the code. So, is there some guide lines / procedure to follow to help me in this process. I remember at school time there was some schema or something to create to display the interaction of different functions / modules My idea was to create a model with all the methods and arrows to link they... any link of post explaining some learning procedure or programs schema would be really appreciated thanks MedeoTL -- http://mail.python.org/mailman/listinfo/python-list
Re: Zealotry [was Re: how to install lxml in window xp?]
On Fri, Jan 13, 2012 at 8:07 PM, Tamer Higazi th9...@googlemail.com wrote: dear people! I have just opened my MTU client, and figured out that through my comment, i caused a complete NONSENSE discussion at all. 1. I am not a zealot or whatever. I code on Linux and port it on MAC and WINDOWS. I do write solutions for customers across the whole 3 platform, and mostly I succeed because I have to figure out in advance which software (packages) are being supported and how far. Use Linux! Specially Gentoo Linux! Screams zealot to me. If not, certainly not a very useful reply. Hey guys, I want to cut the bread, can someone tell me how to use the knife? Use a futuristic laser! Build it yourself for the uber 1337 status! 2. There are many open source projects out (don't ask where, look for yourself, you are old enough!) as well commercial software vendors who don't offer their products, or give support for Windows XP. More fool them; XP is still (unfortunately) heavily used in workplaces and in Universities. Luckily, Windows, unlike Linux, is largely backwards compatible - it's rare to find a program which won't run on XP if it can run on Vista+, unless it's a game that relies on DX11 or something. 3. All of you know, that windows xp is by Microsoft not anymore supported. Neither with Security Updated, Enhancements with Software, SDK or whatever. and not only XP, also Win95,98,ME, and 2000 Professional (not the server editions). Mainstream support ended, yes, but extended support lasts until 2014. Extended support is security updates and the like. http://support.microsoft.com/lifecycle/?C2=1173 4. Of course any OS has it's advantages and disadvantages. Gentoo is a rolling distribution, when it's set up it works nicely. Of course, you have to invest a lot of effort to get in what doesn't mean that Debian and Ubuntu, and the others are worse. Yeah, no. I prefer an operating system that's stable and secure for my servers and for my development. Call me crazy, but I like to get work done. From my personal point of view, I will never set up a gentoo machine as a server in a datacenter, I would rather use BSD Unix. But this is something that personally everybody has to decide for him/herself. Good boy you! I'm glad you've got some sense, there. Now, I hope that I put a line under this discussions and beg the kids between the age of 18 - 24 who are really impulsive to fire around with the guns on others to stop this nonsense thread. That doesn't leave a nice picture in the community. Hate to break it to you, but you started it with Use Linux! Specially Gentoo Linux! -- http://mail.python.org/mailman/listinfo/python-list
Re: NaN, Null, and Sorting
On 13/01/2012 19:58, Chris Angelico wrote: On Sat, Jan 14, 2012 at 6:04 AM, Ethan Furmanet...@stoneleaf.us wrote: So I am strongly leaning towards implementing the comparisons such that Null objects are less than other objects so they will always sort together. This is a perfectly plausible view, and is the one adopted by SQL (I'm pretty sure the NULLS FIRST / NULLS LAST clause is standard - you get to choose whether they're less than everything or more than everything). +1 -- http://mail.python.org/mailman/listinfo/python-list
Re: Problem filling an html form
On 13/01/2012 20:16, Νικόλαος Κούρας wrote: On 13 Ιαν, 21:35, MRABpyt...@mrabarnett.plus.com wrote: On 13/01/2012 17:02, Íéêüëáïò Êïýñáò wrote: # get some enviromental values form = cgi.FieldStorage() mail = form.getvalue('mail') or '' comment = form.getvalue('comment') or '' # insert guest comments into database if form was submitted if '@' in mail and comment not in (ÑùôÞóôå ìå ó÷åôéêÜ...): [snip] Do you really want to look for the comment in that string instead of looking for that string in the comment? What do you mean? I just want to check that the user hasnt pressed the submit button leaving the default values with the input comment box. Iam not sure what you mean. In the first part of the condition you're asking: '@' in mail which is OK, but in the second part of the condition you're asking: comment not in (Ρωτήστε με σχετικά...) which I think should be: Ρωτήστε με σχετικά... not in comment Incidentally, it looks to me like you're using Python 2, in which case it's probably a good idea to use Unicode, so that would be: uΡωτήστε με σχετικά... not in comment and so forth. -- http://mail.python.org/mailman/listinfo/python-list
Re: open office in another language?
Dotan Cohen dotanco...@gmail.com writes: On Wed, Jan 11, 2012 at 00:17, Sean Wolfe ether@gmail.com wrote: hmm I didn't know this, nice to know. Yes, C++ is still enough overhead that I wouldn't want to try extending it ... I bet the code is a whole lot to try and grok. When Apache got the LibreOffice project they heavily refactored the code. As a result, LO is considered less of a monstrosity to hack on than Open Office. You're referring to the Document Foundation, the organisation behind LibreOffice URL:https://www.documentfoundation.org/. The confusion is understandable, since it's been actively fomented for years. Apache have the code base named OpenOffice.org (which is why the Document Foundation had no option but to re-name their project), but that's not where the action is now for the office suite we know and love. It's merely where Oracle pushed their officially blessed code under a different license, though without the majority of developers and without any free-software operating systems actually using it, the writing is on the wall for that code. Oracle are being actively confusing about the name, too. Not only did they (like Sun before them) act so hostile to the OpenOffice.org project that the LibreOffice fork resulted, they then chose not to bless that fork with the OpenOffice name. They also didn't pass the name to Apache, instead releasing another, different code dump with the OpenOffice name for more confusion URL:https://lwn.net/Articles/473355/, undermining the Apache *and* Document Foundation projects. LibreOffice is the one with the large active developer community and the healthy independent foundation and huge funding from dozens of organisations and the refactored code base and a new major release and several versions released in the past year and lots of improvements every time and adoption by every major free-software operating system. It's a shame that corporate politics resulted in this legacy of confusion that needs untangling. The simple take-away is: OpenOffice is dead, long live LibreOffice. -- \ “[W]hoever is able to make you absurd is able to make you | `\unjust.” —Voltaire | _o__) | Ben Finney -- http://mail.python.org/mailman/listinfo/python-list
Re: copy on write
On 2012-01-13, Evan Driscoll edrisc...@wisc.edu wrote: On 01/13/2012 10:54 AM, Neil Cerutti wrote: If you've ever implemented operator=, operator+, and operator+= in C++ you'll know how and why they are different. At the same time, you'd also know that that implementing them in such a way that 'a += b' does *not* perform the same action as 'a = a + b' is considered very bad-mannered. In fact, it's often suggested (e.g. in More Effective C++'s Item 22, though this is not the main thrust of that section) to implement operator+ in terms of += to ensure that this is the case: MyType operator+ (MyType left, MyType right) { MyType copy = left; copy += right; return copy; } They perform the same action, but their semantics are different. operator+ will always return a new object, thanks to its signature, and operator+= shall never do so. That's the main difference I was getting at. A C++ programmer would be wondering how either can work on immutable objects, and that's where Python's magical rebinding semantics come into play. IMO a C++ programmer wouldn't be likely to wonder that much at all because he or she wouldn't view the objects as immutable to begin with. :-) 'x = 5; x += 1;' makes perfect sense in C++, just for a somewhat different reason. I was thinking of const objects, but you are correct that immutable isn't really a C++ concept. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list
Re: Problem filling an html form
On 13 Ιαν, 23:13, MRAB pyt...@mrabarnett.plus.com wrote: On 13/01/2012 20:16, Νικόλαος Κούρας wrote: On 13 Ιαν, 21:35, MRABpyt...@mrabarnett.plus.com wrote: On 13/01/2012 17:02, Íéêüëáïò Êïýñáò wrote: # get some enviromental values form = cgi.FieldStorage() mail = form.getvalue('mail') or '' comment = form.getvalue('comment') or '' # insert guest comments into database if form was submitted if '@' in mail and comment not in (ÑùôÞóôå ìå ó÷åôéêÜ...): [snip] Do you really want to look for the comment in that string instead of looking for that string in the comment? What do you mean? I just want to check that the user hasnt pressed the submit button leaving the default values with the input comment box. Iam not sure what you mean. In the first part of the condition you're asking: '@' in mail which is OK, but in the second part of the condition you're asking: comment not in (Ρωτήστε με σχετικά...) which I think should be: Ρωτήστε με σχετικά... not in comment Incidentally, it looks to me like you're using Python 2, in which case it's probably a good idea to use Unicode, so that would be: uΡωτήστε με σχετικά... not in comment and so forth. Ah yes i have had them reversed! I corrected that now but still if the user submits the form by not entering any input all the program does is reloads itself. So the question now is why the program flow doesn't enter the if code block since its conditions are met? ps. http//superhost.gr/hosting.html is now http//superhost.gr/ directly. -- http://mail.python.org/mailman/listinfo/python-list
Re: copy on write
Ethan Furman於 2012年1月14日星期六UTC+8上午2時40分47秒寫道: Steven D'Aprano wrote: Normally this is harmless, but there is one interesting little glitch you can get: t = ('a', [23]) t[1] += [42] Traceback (most recent call last): File stdin, line 1, in module TypeError: 'tuple' object does not support item assignment t ('a', [23, 42]) There is one other glitch, and possibly my only complaint: -- a = [1, 2, 3] -- b = 'hello, world' -- a = a + b Traceback (most recent call last): File stdin, line 1, in module TypeError: can only concatenate list (not str) to list -- a += b -- a [1, 2, 3, 'h', 'e', 'l', 'l', 'o', ',', ' ', 'w', 'o', 'r', 'l', 'd'] IMO, either both + and += should succeed, or both should fail. ~Ethan~ The += operator is not only for value types in the above example. An operator of two operands and an operator of three operands of general object types are two different operators. -- http://mail.python.org/mailman/listinfo/python-list
Re: copy on write
On 01/13/2012 03:20 PM, Neil Cerutti wrote: They perform the same action, but their semantics are different. operator+ will always return a new object, thanks to its signature, and operator+= shall never do so. That's the main difference I was getting at. I was talking about the combination of + and =, since the discussion is about 'a = a + b' vs 'a += b', not 'a + b' vs 'a += b' (where the differences are obvious). And I stand by my statement. In 'a = a + b', operator+ obviously returns a new object, but operator= should then go and assign the result to and return a reference to 'a', just like how 'a += b' will return a reference to 'a'. If you're working in C++ and overload your operators so that 'a += b' and 'a = a + b' have different observable behaviors (besides perhaps time), then either your implementation is buggy or your design is very bad-mannered. Evan -- http://mail.python.org/mailman/listinfo/python-list
Re: Zealotry [was Re: how to install lxml in window xp?]
On 1/13/2012 3:42 PM, Noah Hall wrote: On Fri, Jan 13, 2012 at 8:07 PM, Tamer Higazith9...@googlemail.com wrote: dear people! I have just opened my MTU client, and figured out that through my comment, i caused a complete NONSENSE discussion at all. 1. I am not a zealot or whatever. I code on Linux and port it on MAC and WINDOWS. I do write solutions for customers across the whole 3 platform, and mostly I succeed because I have to figure out in advance which software (packages) are being supported and how far. Use Linux! Specially Gentoo Linux! Screams zealot to me. If not, certainly not a very useful reply. Noah, those last two lines you quoted are NOT in the post you are quoting. Perhaps Tamer said them previously. If so, you should say so: In a previous post, you said Otherwise, it looks like you made those up and put words in his pen. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list
Re: Zealotry [was Re: how to install lxml in window xp?]
On Fri, 13 Jan 2012 15:32:06 +, John Gordon wrote: In 4f0fbad0$0$29984$c3e8da3$54964...@news.astraweb.com Steven D'Aprano steve+comp.lang.pyt...@pearwood.info writes: Why is it that only Linux and Mac users are accused of being zealots? Perhaps because Windows, being in a position of market dominance, doesn't *need* zealots. There are plenty of Windows zealots around. They just don't get called zealots, because they are the establishment. Treason doth never prosper: what's the reason? For if it prosper, none dare call it treason. Sir John Harington -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: ERROR:root:code for hash md5 was not found
On Fri, 13 Jan 2012 06:14:50 -0800, mike wrote: On Jan 13, 5:41 am, alex23 wuwe...@gmail.com wrote: On Jan 13, 1:34 pm, Steven D'Aprano steve +comp.lang.pyt...@pearwood.info wrote: What is pysibelius? I can't find it on the web. Does it have anything to do with Sibelius the music composition software? Yes, please provide more information about the pysibelius package, especially if this is the case. The few tenuous Python/Sibelius links I found didn't have anything on pysibelius, unfortunately. Hi, pysibelius is a lib that we use. I am not sure that is the problem since the python program works on SuSE but not on RH server. And AFAIK the only difference ( well that I can see) is the OpenSSL version. OpenSSL is irrelevant. If it isn't available, or doesn't provide md5, then the hashlib library will use its own implementation. But the _md5 module is missing in the pysibelius Python on your RedHat system. As I said, your Python installation is seriously broken. Required modules are just *gone*. pysibelius appears to have patched Python in some way, because strange unexpected error messages are being printed that do not happen on a normal unpatched Python, e.g.: ERROR:root:code for hash sha224 was not found. That is not a normal Python error message. That looks like something added by pysibelius. -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Hash stability
On the Python Dev mailing list, there is a discussion going on about the stability of the hash function for strings. How many people rely on hash(some_string) being stable across Python versions? Does anyone have code that will be broken if the string hashing algorithm changes? -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: NaN, Null, and Sorting
On Fri, 13 Jan 2012 11:04:48 -0800, Ethan Furman wrote: With NaN, it is possible to get a list that will not properly sort: -- NaN = float('nan') -- spam = [1, 2, NaN, 3, NaN, 4, 5, 7, NaN] -- sorted(spam) [1, 2, nan, 3, nan, 4, 5, 7, nan] I'm constructing a Null object with the semantics that if the returned object is Null, it's actual value is unknown. From a purist point of view if it is unknown then comparison results are also unknown since the actual value might be greater, lesser, or the same as the value being compared against. From a purist point of view, NANs are unordered with respect to numbers, and so one of two behaviours should occur: (1) nan OP x should raise an exception, for all comparison operators except == and != (2) nan OP x should return False for all OPs except != I believe the current version of the standard supports operators for both sets of behaviour; the 1990s version of Apple's numeric framework (SANE) included both. I think Python chooses the second behaviour, although it may be version and platform dependent. This is from Python 2.6: float('nan') 0 False float('nan') 0 False I would expect the same behaviour for your Null objects. But as you say: From a practical point of view a list with Nulls scattered throughout is a pain in the backside. And this is why sorting should be defined in terms of a separate sorting operator, not or , so that lists containing unordered values like NANs, Nulls, and complex numbers, can be sorted. Sorted is a property of the list, not the values within the list. So I am strongly leaning towards implementing the comparisons such that Null objects are less than other objects so they will always sort together. Thoughts/advice/criticisms/etc? Possibly the least-worst solution. -- Steven -- http://mail.python.org/mailman/listinfo/python-list
logging and httphandler
I am logging to my Apache web server, using this Apache format: LogFormat %{%Y-%m-%d %H:%M:%S}t %U %q scriptlog CustomLog /var/log/apache2/script.log scriptlog My code is as follows: #!/usr/bin/env python3 import logging, logging.handlers, sys logger = logging.getLogger('simple_example') logger.setLevel(logging.DEBUG) host = localhost:9090 url = make_deployment_group http_handler = logging.handlers.HTTPHandler(host, url, method='GET') http_formatter = logging.Formatter('%(name)s - %(levelname)8s - %(message)s') http_handler.setFormatter(http_formatter) logger.addHandler(http_handler) logger.warn('warn message') which results in a entry at /var/log/apache2/script.log: 2012-01-14 05:22:52 make_deployment_group?threadName=MainThreadname=simple_examplethread=139923654465280created=1326518572.83process=31122processName=MainProcessargs=%28%29module=my-loggingfilename=my-logging.pylevelno=30exc_text=Nonepathname=my-logging.pylineno=33asctime=2012-01-14+05%3A22%3A52%2C825msg=warn+messageexc_info=Nonemessage=warn+messagefuncName=%3Cmodule%3ErelativeCreated=20.0970172882levelname=WARNINGmsecs=825.411081314 All the information one could want, which is nice, but is there a way to specify I want only certain information sent via the HTTP request? -- http://mail.python.org/mailman/listinfo/python-list
Interpreting Surface Weather Stations reports (FM 12–XIV SYNOP)
Does anyone have some code which interprets Surface Weather Stations reports (formally termed 'FM 12–XIV SYNOP' reports) ? I've tried the cheese shop but no joy. I've seen PyMetar (http://schwarzvogel.de/software-pymetar.shtml) but I don't believe it covers this format. I can't believe I'm the first person who wished to parse these reports so I'm hoping there's someone out there who's willing to share. I've been referred to http://www.wmo.int/pages/prog/www/WMOCodes/Manual/Volume-I-selection/Sel2.pdf as an explanation of their structure but I would prefer not to delve into that if I could avoid it. -- http://mail.python.org/mailman/listinfo/python-list
Re: NaN, Null, and Sorting
On 13 jan, 20:04, Ethan Furman et...@stoneleaf.us wrote: With NaN, it is possible to get a list that will not properly sort: -- NaN = float('nan') -- spam = [1, 2, NaN, 3, NaN, 4, 5, 7, NaN] -- sorted(spam) [1, 2, nan, 3, nan, 4, 5, 7, nan] I'm constructing a Null object with the semantics that if the returned object is Null, it's actual value is unknown. Short answer. - NaN != NA() - I find the actual implementation (Py3.2) quite satisfying. (M. Dickinson's work) jmf -- http://mail.python.org/mailman/listinfo/python-list
[issue10344] codecs.readline doesn't care buffering=0
Terry J. Reedy tjre...@udel.edu added the comment: Something seems wrong somewhere. First, codecs.open(filename, mode[, encoding[, errors[, buffering]]]) in the doc, should be, to match the code, in the current sytle codecs.open(filename, mode='rb', encoding=None, errors='strict', buffering=1) The other entries below follow this style. The Note says Files are always opened in binary mode, even if no binary mode was specified.. However, the code is if encoding is not None and \ 'b' not in mode: # Force opening of the file in binary mode mode = mode + 'b' so the forcing only happens when an encoding is given. Since the intent is that codecs.open == open when no encoding is given, I believe the Note should be revised rather than the code. (buffering=1) means line buffered. However, the doc for builtin open() says about buffering 1 to select line buffering (only usable in text mode) So the default buffering is one that is not usable in the normal forced binary mode. Marc-Andre, can you explain this? (The doc for open() does not specify what happens when the buffering conflicts with the mode.) The doc for StreamReader.readline() says size, if given, is passed as size argument to the stream’s readline() method.. If that were true, size would the max bytes to read. However, the docstring for the same in codecs.py says size, if given, is passed as size argument to the read() method., and that is what the code does. If not given, 72 is used as the default. (Why not 80?) So, while the doc needs a minor tweak, I do not see what the OP's posted original result has to do with buffering. .readline does not have a fixed internal buffer of 72 chars that I can see. Rather, that is the default number of chars to read. So that is what it read, given that the file is longer than that. I believe this is what Marc-Andre said, in different words, in his first post, in between the distraction of whether to remove open. Santiago, yes, there is a difference between open.readline and codecs.readline. It will be more obvious when the codecs.readline size doc is corrected to specify that it is passed to read(), not readline(), and that it defaults to 72. -- versions: +Python 3.3 -Python 3.1 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10344 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10344] codecs.StreamReader.readline doc needs fix
Terry J. Reedy tjre...@udel.edu added the comment: What I described is the behavior of codecs.StreamReader. However, the streamreader associated with a particular encoding(codec) might do differently. My understanding is that StreamReader is an example that a particular codec can use, derive from, or merely mimic the interface of. -- title: codecs.readline doesn't care buffering=0 - codecs.StreamReader.readline doc needs fix ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10344 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13778] Python should invalidate all non-owned 'thread.lock' objects when forking
New submission from lesha pybug.20.le...@xoxy.net: Here is a great description of the issue: http://docs.oracle.com/cd/E19683-01/806-6867/gen-1/index.html This enhancement proposes a way to make Python more resistant to this kind of deadlock. Consider this program: import threading import subprocess import time l = threading.Lock() def f(): l.acquire() time.sleep(1) l.release() t = threading.Thread(target=f) t.start() def g(l): l.acquire() l.release() print 'ohai' subprocess.Popen(['ls'], preexec_fn=lambda: g(l)) g() gets called in the forked process, which means that it's waiting on a *copy* of the lock, which can never get released. This, in turn, means that the main thread will forever wait for the Popen to finish. The program above incorrectly assumes that a threading lock can be shared across fork() parent and child. I suspect adding such sharing is impractical, requiring OS support or excessive complexity. If the sharing could be had cheaply, it would be great -- programs like this would work as intended, but no other programs would break. Crazy idea: free the locks. Sadly, that is not safe! The ones that are currently locked by other threads might be protecting some network resource, and allowing the fork child to access them would result in a logical error. However, it is always a bad idea for a fork() child to access a lock that is held by a thread that is not its fork() parent. That lock was locked at the time of the fork(), and will stay locked, because the child process will not get updated by the lock-holding threads. So, it is always invalid to access that type of lock. Currently, you are guaranteed a deadlock. Proposal: trying to acquire such a lock should crash the forked child with a nice, detailed error message (including the offending lock), rather than hang the entire program. Sample steps to implement: 1) Store the process ID on each lock instance. 2) Acquire/release should crash if the lock does not belong to the current thread AND has a different process ID from the current one. There are other potential implementations, such as explicitly enumerating such locks at the time of fork, and invalidating them. This crash cannot be an exception in the child, because lock methods must not throw. However, it can and should be an exception in the fork() parent. I think this enhancement would make it much easier to debug this kind of problem. It's an easy mistake to make, because preexec_fn or fork docs do not warn you of the danger, and locks can be acquired quite implicitly by innocent-looking code. -- components: Library (Lib) messages: 151165 nosy: lesha priority: normal severity: normal status: open title: Python should invalidate all non-owned 'thread.lock' objects when forking type: enhancement versions: Python 2.6, Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13778 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13778] Python should invalidate all non-owned 'thread.lock' objects when forking
lesha pybug.20.le...@xoxy.net added the comment: Actually, I think it does not matter which thread owns the lock, it is still invalid to try to acquire a lock that was grabbed by the fork() parent. Why? Because the fork() parent cannot free the child's copy of the lock anyway, and it's guaranteed to be dead also. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13778 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13703] Hash collision security issue
Zbyszek Szmek zbys...@in.waw.pl added the comment: Added some small comments in http://bugs.python.org/review/13703/show. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13703 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13778] Python should invalidate all non-owned 'thread.lock' objects when forking
Changes by Charles-François Natali neolo...@free.fr: -- resolution: - duplicate stage: - committed/rejected status: open - closed superseder: - Locks in python standard library should be sanitized on fork ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13778 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6721] Locks in python standard library should be sanitized on fork
lesha pybug.20.le...@xoxy.net added the comment: Just wanted to say that I spent something like 8 hours debugging a subprocess + threading + logging deadlock on a real production system. I suspected one of my locks at first, but I couldn't find any. The post-fork code was very simple, and I didn't suspect that logging would be subject to the same issue. The good news that I see a very clean solution for fixing this. We can't free all locks across fork -- that is unsafe and mad, because the child might end up corrupting some shared (network) resource, for example/ However, extending RLock to provide ForkClearedRLock (this would be used by logging, i.e.) is quite straighforward. The extended class would simply need to record the process ID, in which the lock was created, and the process ID, which is trying to acquire it. Done! -- nosy: +lesha ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6721 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13779] os.walk: bottom-up
New submission from patrick vrijlandt patrick.vrijla...@gmail.com: PythonWin 3.2 (r32:88445, Feb 20 2011, 21:29:02) [MSC v.1500 32 bit (Intel)] on win32. Portions Copyright 1994-2008 Mark Hammond - see 'Help/About PythonWin' for further copyright information. import os os.makedirs(g:/a/b/c) os.listdir(g:/a) ['b'] for root, dirs, files in os.walk(g:/a, topdown = False): ... print(root, dirs, files, os.listdir(root)) ... os.rmdir(root) ... g:/a\b\c [] [] [] g:/a\b ['c'] [] [] g:/a ['b'] [] [] From the documentation of os.walk: If topdown is False, the triple for a directory is generated after the triples for all of its subdirectories (directories are generated bottom-up). As the above example shows, the directories are generated in the correct order, generated referring to yield from generator os.walk. However, the generated (files? and) dirs do not necessarily reflect the current situation as produced by os.listdir. Therefore, this does not clear the entire directory tree as I would expect. os.makedirs(g:/a/b/c) for root, dirs, files in os.walk(g:/a, topdown = False): ... print(root, dirs, files, os.listdir(root)) ... if not (files + dirs): ... os.rmdir(root) ... g:/a\b\c [] [] [] g:/a\b ['c'] [] [] g:/a ['b'] [] ['b'] I think that at least the documentation should be more clear on this issue. I would like even better, if files + dirs would match os.listdir on the moment they are generated (=yielded). -- assignee: docs@python components: Documentation messages: 151169 nosy: docs@python, patrick.vrijlandt priority: normal severity: normal status: open title: os.walk: bottom-up type: behavior versions: Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13779 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11682] PEP 380 reference implementation for 3.3
Nick Coghlan ncogh...@gmail.com added the comment: Committed for 3.3: http://hg.python.org/cpython/rev/d64ac9ab4cd0 Thanks to Greg for the initial effort on the PEP and reference implementation and to all involved in updating the original patch for 3.3 and getting the tests and documentation to an acceptable state. Any issues discovered after this can be given a new tracker entry :) -- components: +Interpreter Core resolution: - fixed stage: - committed/rejected status: open - closed type: - enhancement ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11682 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13780] make YieldFrom its own node
New submission from Benjamin Peterson benja...@python.org: As promised in a review a while ago of PEP 380. -- files: yieldfromnode.patch keywords: patch messages: 151172 nosy: benjamin.peterson, ncoghlan priority: normal severity: normal status: open title: make YieldFrom its own node Added file: http://bugs.python.org/file24227/yieldfromnode.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13780 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12409] Moving Documenting Python to Devguide
Georg Brandl ge...@python.org added the comment: We'll probably have to redirect all /documenting in Apache anyway. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12409 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13765] Distutils does not put quotes around paths that contain spaces when compiling with MSVC
Almar Klein almar.kl...@gmail.com added the comment: Ok, I went to prepare a minimal example that does not use Cython nor Numpy. And then the problem was gone. Even more so, my fix would cause a problem, because somewhere quotes are placed around the entire command: ...link.exe /DLL /LIBPATH:C:\Program Files (x86)\python32\libs etc. This somewhere is in spawn(), which calls nt_quote_args(). So I went on to search for the cause in Cython, and after that in Numpy. I have no traced it to Numpy, because it does NOT use the nt_quote_args() function of distutils. So I think we can close the issue. I will open an issue at numpy. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13765 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13765] Distutils does not put quotes around paths that contain spaces when compiling with MSVC
Éric Araujo mer...@netwok.org added the comment: OK, thanks. Please add a link to the Numpy or Cython bug report here. -- assignee: tarek - eric.araujo resolution: - invalid stage: patch review - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13765 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13765] Distutils does not put quotes around paths that contain spaces when compiling with MSVC
Almar Klein almar.kl...@gmail.com added the comment: This issue is posted at http://projects.scipy.org/numpy/ticket/2018 -- resolution: invalid - status: closed - open ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13765 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13765] Distutils does not put quotes around paths that contain spaces when compiling with MSVC
Changes by Éric Araujo mer...@netwok.org: -- resolution: - invalid status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13765 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11682] PEP 380 reference implementation for 3.3
Éric Araujo mer...@netwok.org added the comment: Kudos! -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11682 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13473] Add tests for files byte-compiled by distutils[2]
Éric Araujo mer...@netwok.org added the comment: Nick, would you have a bit of time to read my OP and reply? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13473 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13764] Misc/build.sh is outdated... talks about svn
Antoine Pitrou pit...@free.fr added the comment: I think the script was used by the period regression test crontask that used to send emails to python-checkins. The crontask is offline and the script probably hasn't been used by anyone else, so we could indeed remove it. -- components: +Demos and Tools -Build nosy: +brett.cannon, nnorwitz, pitrou priority: normal - low versions: +Python 2.7, Python 3.2, Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13764 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13645] import machinery vulnerable to timestamp collisions
Antoine Pitrou pit...@free.fr added the comment: One is possibly deprecating path_mtime() so people don't waste time implementing it (we actually never need to remove it thanks to the ABC; otherwise we need to make sure the docs strongly state to only bother with path_stats()). Ok, I saw I also forgot to update some importlib docs. The other is to say the mtime key should contain a value that is a real number (ie. float and any other numeric type that can cast to an integer). Ok. And is there any efficient way to get the stat info on a file AND its contents in a single call? I don't think so. os.fstat() on an open fd looks minimally faster than os.stat() on the filename (0.5µs faster here on Linux), but opening the file has its own cost. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13645 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12415] Missing: How to checkout the Doc sources
Changes by Éric Araujo mer...@netwok.org: -- dependencies: +Moving Documenting Python to Devguide ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12415 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12409] Moving Documenting Python to Devguide
Éric Araujo mer...@netwok.org added the comment: About the devguide patch: a) The part about C roles and directives should probably mention version specifics (:cmacro: for 2.7, :c:macro: for 3.x) — unless you make this bug dependent on updating Sphinx to 1.0 for 2.7 and then all versions use new-style :c:. b) You probably want to use ref:documenting instead of :doc:documenting (we always use ref) Not related to your patch, but it made me think about them so I’m just putting it out there for comments: Not sure we should keep the reST basics or just redirect to docutils and Sphinx docs. Likewise, maybe it’s time to stop mentioning the old Latex-based docs. (A nit: there are a few instances of `markup` that should be :file:`etc` or ``code``.) About the cpython patch: You could just have said “rm Doc/documenting” :) Georg, will you be the one to set up the docs.python.org redirects? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12409 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13447] Add tests for some scripts in Tools/scripts
Changes by Éric Araujo mer...@netwok.org: -- title: Add tests for Tools/scripts/reindent.py - Add tests for some scripts in Tools/scripts ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13447 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1475523] gettext breaks on plural-forms header
Changes by Éric Araujo mer...@netwok.org: -- dependencies: +Add tests for some scripts in Tools/scripts ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1475523 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1475523] gettext breaks on plural-forms header
Changes by Éric Araujo mer...@netwok.org: -- dependencies: -Add tests for some scripts in Tools/scripts ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1475523 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12409] Moving Documenting Python to Devguide
Sandro Tosi sandro.t...@gmail.com added the comment: Hi Éric, thanks for the review. On Fri, Jan 13, 2012 at 18:13, Éric Araujo rep...@bugs.python.org wrote: Éric Araujo mer...@netwok.org added the comment: About the devguide patch: a) The part about C roles and directives should probably mention version specifics (:cmacro: for 2.7, :c:macro: for 3.x) — unless you make this bug dependent on updating Sphinx to 1.0 for 2.7 and then all versions use new-style :c:. yeah, I'd love to not write both rules/directives formats to later revert this addition, so ok, let's make this bug depending on the migration to sphinx 1.0 of the 2.7 version. I've sent a follow-up of that task to python-dev some days ago, and comments (and help!) would be welcome there too. b) You probably want to use ref:documenting instead of :doc:documenting (we always use ref) ah ok, I just used the same role that was there; updated to use :ref: - fixed that (just pushed on my repo, not updated patch yet) Not related to your patch, but it made me think about them so I’m just putting it out there for comments: Not sure we should keep the reST basics or just redirect to docutils and Sphinx docs. as a matter of personal taste, I like small lists of commonly used commands/roles/directives/whatever in the doc, with additional links as needed, this give a quick idea (that's usually enough) on what to do but also the possibility for further digging (if one wants it). Likewise, maybe it’s time to stop mentioning the old Latex-based docs. we can do that, but maybe at a later step? so now just put the doc in the canonical place, later let's refactor it, removing dead parts and so on? i'm fine anyhow (A nit: there are a few instances of `markup` that should be :file:`etc` or ``code``.) I'll fix them in the mean time. About the cpython patch: You could just have said “rm Doc/documenting” :) eheh, well but a tiny tiny part remains :) if we go for a redirect to the devguide, I'm all for removing all that section from the doc; I left it there in case someone still refers directly to documenting/ or so (but indeed, all the sub-pages are no more reachable). Georg, will you be the one to set up the docs.python.org redirects? I can provide the configuration, but I don't have access to the machine, so some admins must be there as well. Cheers, Sandro -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12409 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13645] import machinery vulnerable to timestamp collisions
Roundup Robot devn...@psf.upfronthosting.co.za added the comment: New changeset 87331661042b by Antoine Pitrou in branch 'default': Issue #13645: pyc files now contain the size of the corresponding source http://hg.python.org/cpython/rev/87331661042b -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13645 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13645] import machinery vulnerable to timestamp collisions
Antoine Pitrou pit...@free.fr added the comment: Now pushed in. Thanks for the reviews! -- resolution: - fixed stage: patch review - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13645 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13764] Misc/build.sh is outdated... talks about svn
Neal Norwitz nnorw...@gmail.com added the comment: If this script isn't used any more, it should be removed. On Fri, Jan 13, 2012 at 8:31 AM, Antoine Pitrou rep...@bugs.python.orgwrote: Antoine Pitrou pit...@free.fr added the comment: I think the script was used by the period regression test crontask that used to send emails to python-checkins. The crontask is offline and the script probably hasn't been used by anyone else, so we could indeed remove it. -- components: +Demos and Tools -Build nosy: +brett.cannon, nnorwitz, pitrou priority: normal - low versions: +Python 2.7, Python 3.2, Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13764 ___ -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13764 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13728] Description of -m and -c cli options wrong?
Sandro Tosi sandro.t...@gmail.com added the comment: Ah indeed, I could have looked at sys.path doc myself after all.. sorry for the noise. -- resolution: - invalid stage: needs patch - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13728 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13761] Add flush keyword to print()
Roundup Robot devn...@psf.upfronthosting.co.za added the comment: New changeset 3120a988a1a3 by Georg Brandl in branch 'default': Closes #13761: add a flush keyword argument to print(). http://hg.python.org/cpython/rev/3120a988a1a3 -- nosy: +python-dev resolution: - fixed stage: needs patch - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13761 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13764] Misc/build.sh is outdated... talks about svn
Roundup Robot devn...@psf.upfronthosting.co.za added the comment: New changeset f36c6f5f9d61 by Antoine Pitrou in branch '3.2': Issue #13764: remove outdated script Misc/build.sh http://hg.python.org/cpython/rev/f36c6f5f9d61 New changeset 609482c6710e by Antoine Pitrou in branch 'default': Issue #13764: remove outdated script Misc/build.sh http://hg.python.org/cpython/rev/609482c6710e New changeset 7fcfbaad75ee by Antoine Pitrou in branch '2.7': Issue #13764: remove outdated script Misc/build.sh http://hg.python.org/cpython/rev/7fcfbaad75ee -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13764 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13764] Misc/build.sh is outdated... talks about svn
Antoine Pitrou pit...@free.fr added the comment: Removed then, thank you. -- resolution: - fixed stage: - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13764 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13746] ast.Tuple's have an inconsistent col_offset value
Georg Brandl ge...@python.org added the comment: This is because the parentheses don't really belong to the tuple literal. You could just as well write b = 1, 3.14, 'abc', u'XYZ' In other cases, the parentheses may be needed for grouping purposes (e.g. in function calls), but they still are only for grouping, just as in (a + b) * c. For the empty tuple, where the parentheses actually are part of the literal, the col_offset is correct. -- nosy: +georg.brandl resolution: - invalid status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13746 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2124] xml.sax and xml.dom fetch DTDs by default
Brian Visel aeon.descrip...@gmail.com added the comment: ..still an issue. -- nosy: +Brian.Visel ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2124 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13737] bugs.python.org/review's Django settings file DEBUG=True
Georg Brandl ge...@python.org added the comment: While the actual code may be accessible to everyone, the server configuration (paths etc. -- just look at the page; at least the session secret key and passwords are masked by Django) are not, and exposing that can be a security problem as well. And while I agree that this possibility appears remote, just look at the current discussion about hashing attacks. Running in debug mode also simply looks bad to just about every web programmer, which explains this bug report. Lastly, setting DEBUG to true also has other consequences, like the possibility to leak memory for long-running processes, as explained here: https://docs.djangoproject.com/en/1.3/faq/models/ -- nosy: +georg.brandl ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13737 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13753] str.join description contains an incorrect reference to argument
Georg Brandl ge...@python.org added the comment: You put '*' instead of '#' in the commit message. Also, I don't think you should close more than one issue in one commit. -- nosy: +georg.brandl ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13753 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13768] Doc/tools/dailybuild.py available only on 2.7 branch
New submission from Georg Brandl ge...@python.org: Why is that a concern? It is not needed for the doc build and intended to be used on python.org only. -- nosy: +georg.brandl resolution: - wont fix status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13768 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1692335] Fix exception pickling: Move initial args assignment to BaseException.__new__
Changes by Georg Brandl ge...@python.org: -- assignee: georg.brandl - ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1692335 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2124] xml.sax and xml.dom fetch DTDs by default
Martin v. Löwis mar...@v.loewis.de added the comment: And my position still remains the same: this is not a bug. Applications affected by this need to use the APIs that are in place precisely to deal with this issue. So I propose to close this report as invalid. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2124 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com