hotel management system
Please can someone look at my code and may be advice and may be help me with some correction. I have been learning python for some time now. This is my first project i wish to write. A hotel management system. http://pastebin.com/LMHmuTiC Thnaks -- https://mail.python.org/mailman/listinfo/python-list
Re: hotel management system
On Tue, Oct 28, 2014 at 5:42 PM, ngangsia akumbo ngang...@gmail.com wrote: Please can someone look at my code and may be advice and may be help me with some correction. I have been learning python for some time now. This is my first project i wish to write. A hotel management system. http://pastebin.com/LMHmuTiC Sure, we can do code reviews! It's usually helpful to provide your code in-line, though, rather than linking to pastebin. You're using Python 2, as evidenced by the print statements. So don't do this, ever: def emp_age(): displaying employees age age = input(Enter age: ) The input function is extremely dangerous. Everywhere else, you use raw_input, which is correct. class Bar: This is an old-style class. It's better to explicitly subclass object: class Bar(object): class Beer(Bar): Not sure why you're doing this. Firstly, you never use your Beer class... but secondly, your Beer isn't a special type of Bar, it's a quite different thing. When you subclass, it's usually helpful to follow the Liskov Substitution Principle: https://en.wikipedia.org/wiki/Liskov_substitution_principle Think carefully about your class hierarchy, because it defines all sorts of things about your code. Be sure you're happy with it before you code up too much else. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Callback functions arguments
Peter Otten __pete...@web.de a écrit dans le message de news:mailman.15231.1414399974.18130.python-l...@python.org... Tanks for you answer Python doesn't know it has to pass an argument, it just does it. Change the callback to def maj(): print(no args) and you'll get an error. If I were to guess Yes you are right. I got an error: TypeError: maj() takes 0 positional arguments but 1 was given OK, but i still find very strange the choice of Python's designers to make the Scale behaves like that. The position of the scale is in variable Valeur (StringVar()) which cold be read/write from anywhere, so it is not necessary to pass this variable as an argument to the call back function. If you are looking at the SpinBox widget, in example 4 in the same web site: http://fsincere.free.fr/isn/python/cours_python_tkinter.php boite = Spinbox(Mafenetre,from_=0,to=10,increment=0.5, \ textvariable=Valeur,width=5,command=carre) with the callback function carre def carre(): Calcul du carré Resultat.set(Carré = +str(float(Valeur.get())**2)) you can notice that carre function has no arguments. The value in the SpinBox is catched with Valeur variable. So SpinBox and Scale behaves differently. It is strange. you probably are misled by the 'command=maj' part in the above line. no, I understood this mechanism -- https://mail.python.org/mailman/listinfo/python-list
Re: Callback functions arguments
On Tue, Oct 28, 2014 at 6:35 PM, ast nom...@invalid.com wrote: OK, but i still find very strange the choice of Python's designers to make the Scale behaves like that. That's nothing to do with Python's design. That's all about Tkinter, which presumably is imitating Tk. Python allows the callback function to be called with whatever arguments the caller wishes; you can look at the docs for the different objects to see what args they'll be giving their callbacks. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Build Question: How to Add -Wl, --option Before Objects In Setup.py?
In article CAHu5PrY-T=DT3wOg-Y+Va9WgwBV3w9d7M-tu=_n-cngwssz...@mail.gmail.com, Cyd Haselton chasel...@gmail.com wrote: [...] I'm building python on an Android device in the KBOX environment...which simulates a Unix type filesystem. Python isn't installed; I'm building from sources (2.7.8) with GCC 4.8.0 and make. The problem with the LDFLAGS approach is that some of the libraries that must be linked (-lc -ldl) do not need the --allow-shlib-undefined option...it's only the lpython2.7 that does. Any way to do this? Sorry, I have no experience with that environment nor an understanding of why you need to specify --allow-shlib-undefined (it seems to be the default in some versions of ld). You could look at and, if necessary, modify Lib/distutils, the part of the Python standard library that builds extension modules from setup.py. -- Ned Deily, n...@acm.org -- https://mail.python.org/mailman/listinfo/python-list
www.python.org
Hi, I recently browsed through your business website and wanted to highlight some key points for consideration. I am sure it will complement your-SEO work to help your website attract only quality visitors and make it scale high on the search .engine results page (SERP) gradually. Would you be interested in receiving the details? Best regards, Eileen Online-Strategist CELLsIX MEDIA PTY LTD. Headquarters: Office 7003 X2 Tower, Cluster X, Melbourne Vic. 3000 Australia Other Branches: Sydney | Perth | Brisbane | Adelaide | Hobart Disclaimer: This e-mail is private and confidential. If you are not the intended recipient, please advise us by return e-mail immediately, and delete the e-mail and any attachments without using or disclosing the contents in any way. The views expressed in this e-mail are those of the author, and do not represent those of this company unless this is clearly indicated. You should scan this e-mail and any attachments for viruses. This company accepts no liability for any direct or indirect damage or loss resulting from the use of any attachments to this e-mail. All quotes received from Cellsix Media by email are informal and not binding until a formal quote is agreed upon by both the parties. -- https://mail.python.org/mailman/listinfo/python-list
Re: Status of side-effecting functions in python
Nobody nobody@nowhere.invalid: Asynchronous I/O in the sense of select(), poll(), O_NONBLOCK etc is meant for situations where delays could be indefinite, e.g. network connections or terminals. For short delays (i.e. disc access), there's not much point having a mechanism so that you can avoid blocking while the data is read from disc just so that you can block while the code in the else branch is read from disc. I disagree with the shortness of the delays. If you want the program to be able to do something else while waiting for I/O, use threads. The introduction of threads made most concurrency- related issues in the POSIX API moot. I disagree about that point of view as well. If files played ball with select() et al, the linux world would be a better, more coherent place. For example, looking at Python3's asyncio, I don't want to go out of the asyncio model just because of disk (or DB) access. Marko -- https://mail.python.org/mailman/listinfo/python-list
Re: Status of side-effecting functions in python
Marko Rauhamaa ma...@pacujo.net: Python's sockets and pipes don't have write methods. Actually, that's mistaken as well. The sys.std* handles and pipes returned by subprocess are accessed using file.write() and thus may return partial writes. That brings up another point: Python3's file.write() returns the number of characters written. What might it return if a partial character should be written? Marko -- https://mail.python.org/mailman/listinfo/python-list
Regex substitution trouble
Hi everyone, I'm not really sure if this is the right place to ask about regular expressions, but since I'm usin python I thought I could give a try :-) Here is the problem, I'm trying to write a regex in order to substitute all the occurences in the form $somechars with another string. This is what I wrote: newstring = re.sub(ur(?u)(\$\[\s\w]+\), subst, oldstring) This works pretty well, but it has a problem, I would need it also to handle the case in which the internal string contains the double quotes, but only if preceeded by a backslash, that is something like $somechars_with\\doublequotes. Can anyone help me to correct it? Thanks in advance! -- https://mail.python.org/mailman/listinfo/python-list
C++ extension and shared library with distutils
Hi folks I have a little problem with a Python extension and could not find a good solution in the documentation. So hopefully someone here has a clever idea. Here is the problem: I have two extensions written in C++ (bindings to existing C++ code). Lets call this two extensions C and B which are part of a larger package with parent A. So in the simplest case the installation on Linux would somehow look like this A/ __init__.py B/ __init__.py _b.so C/ __init__.py _c.so The extension C is optional but depends on B. In the code for C I would like to use some utilities developed for B. The idea was to keep this utility functions in a shared library and link B and C against this library. Lets call this library libb_utils.so. The problem here is that the code in libb_utils.so depends on the Python version used to build the extensions so it is not possible to build a Python agnostic version of the library. My idea now was to build extension B and in the same code tree build libb_utils.so. The idea was to install this shared object along with the extension and then link C against it. The new installation would look like this A/ __init__.py B/ __init__.py _b.so libb_utils.so with header files for libb_utils.so in $PREFIX/include/pythonX.Y/A/B/ My hope is that I can do all this with distutils. Building and installing the extension is trivial. But 1.) is there a better way to build a shared library with distutils than using the CCompiler submodule? 2.) is the way I am planning the installation of my code ok or is there a better way (maybe even a kind of standard) to deal with such a situation. best regards and thanks in advance Eugen Wintersberger signature.asc Description: This is a digitally signed message part -- https://mail.python.org/mailman/listinfo/python-list
Re: Callback functions arguments
Chris Angelico ros...@gmail.com a écrit dans le message de news:mailman.15254.1414482690.18130.python-l...@python.org... On Tue, Oct 28, 2014 at 6:35 PM, ast nom...@invalid.com wrote: That's clear to me now. Spinbox and Scale widgets behave differently, that's all. Command on Scale widget: A procedure to be called every time the slider is moved. This procedure will be passed one argument, the new scale value. If the slider is moved rapidly, you may not get a callback for every possible position, but you'll certainly get a callback when it settles Command on Spinbox widget A procedure to be called whenever the scrollbar is moved. No argument is passed. -- https://mail.python.org/mailman/listinfo/python-list
Re: Regex substitution trouble
On Tue, Oct 28, 2014 at 10:02 PM, massi_...@msn.com wrote: I'm not really sure if this is the right place to ask about regular expressions, but since I'm usin python I thought I could give a try :-) Yeah, that sort of thing is perfectly welcome here. Same with questions about networking in Python, or file I/O in Python, or anything like that. Not a problem! Here is the problem, I'm trying to write a regex in order to substitute all the occurences in the form $somechars with another string. This is what I wrote: newstring = re.sub(ur(?u)(\$\[\s\w]+\), subst, oldstring) This works pretty well, but it has a problem, I would need it also to handle the case in which the internal string contains the double quotes, but only if preceeded by a backslash, that is something like $somechars_with\\doublequotes. Can anyone help me to correct it? But this is a problem. You can use look-ahead assertions and such to allow the string \ inside your search string, but presumably the backslash ought itself to be escapable, in order to make it possible to have a loose backslash legal at the end of the string. I suggest that, instead of a regex, you look for a different way of parsing. What's the surrounding text like? ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Python Fabric on Windows :
On 27/10/2014 04:49, Ganesh Pal wrote: Hi Team , Iam new to Fabric and Iam using the fab command-line tool to run a set of task on Linux clients. I just started coding and Iam pretty new to fabric, Iam hoping I will be able to launch my fabric scripts from both Windows and Linux Machine . I found fabric on windows quite hard, but I have managed to use it. For ssh I think I had to use the putty tools eg plink to do remote work. On the other hand I find plumbum much easier http://tomerfiliba.com/blog/Plumbum/ Installing Cygwin might help in windows case I guess. please suggest if you foresee problems using fabric on Windows and also suggest an alternative to this if available. . -- Robin Becker -- https://mail.python.org/mailman/listinfo/python-list
Re: memory, PE files, etc...
On Tuesday, October 28, 2014 3:37:19 AM UTC+1, Rustom Mody wrote: On Tuesday, October 28, 2014 12:41:40 AM UTC+5:30, kiuh...@yahoo.it wrote: On Monday, October 27, 2014 6:24:19 PM UTC+1, Tim Golden wrote: psutil is definitely your friend: https://github.com/giampaolo/psutil Although WMI can be quite handy too, depending on what you're trying to do: http://timgolden.me.uk/python/wmi/ TJG Thanks for answering. I don't know if psutil is what I'm looking for. What I need to do is more related to debugging than to administration. Let's say I want to search for a sequence of bytes in the .text section of a given module. Can I do that with psutil? https://code.google.com/p/pefile/ ? I need to analyze the memory of running processes. The answer is PyDbg or direct access to the API of Windows. -- https://mail.python.org/mailman/listinfo/python-list
Re: Regex substitution trouble
Hi Chris, thanks for the reply. I tried to use look ahead assertions, in particular I modified the regex this way: newstring = re.sub(ur(?u)(\$\[\s\w(?=\\)\]+\), subst, oldstring) but it does not work. I'm absolutely not a regex guru so I'm surely missing something. The strings I'm dealing with are similar to formulas, let's say something like: '$[simple_input]+$[messed_\\_input]+10' Thanks for any help! -- https://mail.python.org/mailman/listinfo/python-list
Re: Regex substitution trouble
(Please quote enough of the previous text to provide context, and write your replies underneath the quoted text - don't assume that everyone's read the previous posts. Thanks!) On Tue, Oct 28, 2014 at 11:28 PM, massi_...@msn.com wrote: Hi Chris, thanks for the reply. I tried to use look ahead assertions, in particular I modified the regex this way: newstring = re.sub(ur(?u)(\$\[\s\w(?=\\)\]+\), subst, oldstring) but it does not work. I'm absolutely not a regex guru so I'm surely missing something. Yeah, I'm not a high-flying regex programmer either, so I'll leave the specifics for someone else to answer. Tip, though: Print out your regex, to see if it's really what you think it is. When you get backslashes and quotes coming through, sometimes you can get tangled, even in a raw string literal; sometimes, one quick print(some_re) can save hours of hair-pulling. The strings I'm dealing with are similar to formulas, let's say something like: '$[simple_input]+$[messed_\\_input]+10' Thanks for any help! Hmm. This looks like a job for ast.literal_eval with an actual dictionary. All you'd have to do is replace every instance of $ with a dict literal; it mightn't be efficient, but it would be safe. Using Python 2.7.8 as you appear to be on 2.x: expr = '$[simple_input]+$[messed_\\_input]+10' values = {simple_input:123, messed_\_input:75} ast.literal_eval(expr.replace($,repr(values))) Traceback (most recent call last): File pyshell#4, line 1, in module ast.literal_eval(expr.replace($,repr(values))) File C:\Python27\lib\ast.py, line 80, in literal_eval return _convert(node_or_string) File C:\Python27\lib\ast.py, line 79, in _convert raise ValueError('malformed string') ValueError: malformed string Unfortunately, it doesn't appear to work, as evidenced by the above message. It works with the full (and dangerous) eval, though: eval(expr.replace($,repr(values))) 208 Can someone who better knows ast.literal_eval() explain what's malformed about this? The error message in 3.4 is a little more informative, but not much more helpful: ValueError: malformed node or string: _ast.BinOp object at 0x0169BAF0 My best theory is that subscripting isn't allowed, though this seems odd. In any case, it ought in theory to be possible to use Python's own operations on this. You might have to do some manipulation, but it'd mean you can leverage a full expression evaluator that already exists. I'd eyeball the source code for ast.literal_eval() and see about making an extended version that allows the operations you want. If you can use something other than a dollar sign - something that's syntactically an identifier - you'll be able to skip the textual replace() operation, which is risky (might change the wrong thing). Do that, and you could have your own little evaluator that uses the ast module for most of its work, and simply runs a little recursive walker that deals with the nodes as it finds them. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Regex substitution trouble
On Tue, Oct 28, 2014 at 4:02 AM, massi_...@msn.com wrote: Hi everyone, I'm not really sure if this is the right place to ask about regular expressions, but since I'm usin python I thought I could give a try :-) Here is the problem, I'm trying to write a regex in order to substitute all the occurences in the form $somechars with another string. This is what I wrote: newstring = re.sub(ur(?u)(\$\[\s\w]+\), subst, oldstring) This works pretty well, but it has a problem, I would need it also to handle the case in which the internal string contains the double quotes, but only if preceeded by a backslash, that is something like $somechars_with\\doublequotes. Can anyone help me to correct it? Thanks in advance! -- https://mail.python.org/mailman/listinfo/python-list Carefully reading the Strings section of Example Regexes to Match Common Programming Language Constructs [1] should (with a bit of effort), solve your problem I think. Note the use of the negated character class for one thing. [1] http://www.regular-expressions.info/examplesprogrammer.html -- https://mail.python.org/mailman/listinfo/python-list
bulk sms with python
I need to build a bulk SMS system for a particular group of users. i WAS THINKING OF USING RAPIDSMS, AND KANNEL. Is there not a way to use just python from scratch to build a bulk sms system or if there are other simpler means please indicate to me. Thanks Ngangsi Richard skyoe: ngangsia.richard -- https://mail.python.org/mailman/listinfo/python-list
Re: bulk sms with python
Sounds like you want to use Twisted or something to implement the SMPP protocol. That's not trivial, but probably not too difficult; if you don't need message delivery confirmation, it should be stateless. Bob On Tue, Oct 28, 2014 at 8:01 AM, ngangsia akumbo ngang...@gmail.com wrote: I need to build a bulk SMS system for a particular group of users. i WAS THINKING OF USING RAPIDSMS, AND KANNEL. Is there not a way to use just python from scratch to build a bulk sms system or if there are other simpler means please indicate to me. Thanks Ngangsi Richard skyoe: ngangsia.richard -- https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list
Re: Anyone know the solution
On Tuesday, October 28, 2014 12:25:13 AM UTC-4, Terry Reedy wrote: On 10/27/2014 11:10 AM, emmanuel...@gmail.com wrote: THIS IS THE LIST OF BOY NAMES Jacob ... Writing hundreds of unnecessary lines at minimum inconsiderate. Please don't do it. -- Terry Jan Reedy The python programming community is BY FAR the best I've been in touch with. Asking for help with some code that is not working is OK here, but asking to have the homework done is disgusting. Just try mentioning the word homework on c++ or javascrip groups: They'll bully you to death! -- https://mail.python.org/mailman/listinfo/python-list
Re: OS X Menubar in Tkinter
On Thursday, 23 October 2014 20:02:43 UTC+1, Chris Angelico wrote: I don't think it's possible to auto-solve the Google Groups formatting issues at the mailing list level, as the fundamental problem is that information isn't being transmitted. (Forcing everything to be wrapped and forcing blank line removal risks breaking other formatting.) The last time I had a job interview with Google, I said that I wanted to spend my 20% time fixing Google Groups' paragraph handling... and then they didn't hire me. Not sure if this is coincidental or not. :) ChrisA Hopefully something may be happening... https://productforums.google.com/d/msg/apps/4WQcWWajjvU/0NF7JgezGS0J -- https://mail.python.org/mailman/listinfo/python-list
Re: OS X Menubar in Tkinter
On Tuesday, October 28, 2014 9:18:09 PM UTC+5:30, Simon Kennedy wrote: On Thursday, 23 October 2014 20:02:43 UTC+1, Chris Angelico wrote: I don't think it's possible to auto-solve the Google Groups formatting issues at the mailing list level, as the fundamental problem is that information isn't being transmitted. (Forcing everything to be wrapped and forcing blank line removal risks breaking other formatting.) The last time I had a job interview with Google, I said that I wanted to spend my 20% time fixing Google Groups' paragraph handling... and then they didn't hire me. Not sure if this is coincidental or not. :) ChrisA Hopefully something may be happening... https://productforums.google.com/d/msg/apps/4WQcWWajjvU/0NF7JgezGS0J Yay! Seems to be fixed! [Posted from GG without my usual post-processing filter. Ok??] -- https://mail.python.org/mailman/listinfo/python-list
Re: OS X Menubar in Tkinter
On Wed, Oct 29, 2014 at 2:47 AM, Simon Kennedy sffjun...@gmail.com wrote: On Thursday, 23 October 2014 20:02:43 UTC+1, Chris Angelico wrote: I don't think it's possible to auto-solve the Google Groups formatting issues at the mailing list level, as the fundamental problem is that information isn't being transmitted. (Forcing everything to be wrapped and forcing blank line removal risks breaking other formatting.) The last time I had a job interview with Google, I said that I wanted to spend my 20% time fixing Google Groups' paragraph handling... and then they didn't hire me. Not sure if this is coincidental or not. :) ChrisA Hopefully something may be happening... https://productforums.google.com/d/msg/apps/4WQcWWajjvU/0NF7JgezGS0J Wow! That'd be awesome. If they can properly wrap text and not double-space, most of the GG issues would vanish. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Anyone know the solution
This is a sample code on how to read data from a file files1 {} result = open(file1.txt) for line in result: file1 = linesplit() files1.append(file1) result.close() file1.sort() file1.reverse() print('THE FILE INFO') print(file1(0) print(file1(1) -- https://mail.python.org/mailman/listinfo/python-list
Re: Regex substitution trouble
On Tuesday, October 28, 2014 7:03:00 AM UTC-4, mass...@msn.com wrote: Hi everyone, I'm not really sure if this is the right place to ask about regular expressions, but since I'm usin python I thought I could give a try :-) Here is the problem, I'm trying to write a regex in order to substitute all the occurences in the form $somechars with another string. This is what I wrote: newstring = re.sub(ur(?u)(\$\[\s\w]+\), subst, oldstring) This works pretty well, but it has a problem, I would need it also to handle the case in which the internal string contains the double quotes, but only if preceeded by a backslash, that is something like $somechars_with\\doublequotes. Can anyone help me to correct it? Thanks in advance! You have some good answers already, but I wanted to let you know about a tool you may already have which is useful for experimenting with regexps. On windows, the file `redemo.py` is in the Tools/Scripts folder. If you're on a Mac, see http://stackoverflow.com/questions/1811236/how-can-i-run-redemo-py-or-equivalent-on-a-mac It has really helped me work on some tough regexps. good luck, --Tim -- https://mail.python.org/mailman/listinfo/python-list
Re: Regex substitution trouble
On 2014-10-28 12:28, massi_...@msn.com wrote: Hi Chris, thanks for the reply. I tried to use look ahead assertions, in particular I modified the regex this way: newstring = re.sub(ur(?u)(\$\[\s\w(?=\\)\]+\), subst, oldstring) but it does not work. I'm absolutely not a regex guru so I'm surely missing something. The strings I'm dealing with are similar to formulas, let's say something like: '$[simple_input]+$[messed_\\_input]+10' Thanks for any help! Your original post said you wanted to match strings like: $somechars_with\\doublequotes. This regex will do that: ur'\$[^\\]*(?:\\.[^\\]*)*' However, now you say you want to match: '$[simple_input]' This is different; it has '[' immediately after the '$' instead of ''. -- https://mail.python.org/mailman/listinfo/python-list
[ANN] dbf v0.96 is released
and finally supports Python 3! :) Versions supported are 2.5 - 2.7, and 3.2+ = dbf === dbf (also known as python dbase) is a module for reading/writing dBase III, FP, VFP, and Clipper .dbf database files. It's an ancient format that still finds lots of use (the most common I'm aware of is retrieving legacy data so it can be stored in a newer database system; other uses include GIS, stand-alone programs such as Family History, Personal Finance, etc.). Highlights -- Table -- represents a single .dbf/.dbt (or .fpt) file combination and provides access to records; suports the sequence access and 'with' protocols. Temporary tables can also live entirely in memory. Record -- repesents a single record/row in the table, with field access returning native or custom data types; supports the sequence, mapping, attribute access (with the field names as the attributes), and 'with' protocols. Updates to a record object are reflected on disk either immediately (using gather() or write()), or at the end of a 'with' statement. Index -- nonpersistent index for a table. Fields:: dBase III (Null not supported) Character -- unicode Date -- datetime.date or None Logical -- bool or None Memo -- unicode or None Numeric -- int/float depending on field definition or None Float -- same as numeric Clipper (Null not supported) Character -- unicode (character fields can be up to 65,519) Foxpro (Null supported) General -- str/bytes (treated as binary) Picture -- str/bytes (treated as binary) Visual Foxpro (Null supported) Currency -- decimal.Decimal douBle-- float Integer -- int dateTime -- datetime.datetime If a field is uninitialized (Date, Logical, Numeric, Memo, General, Picture) then None is returned for the value. Custom data types:: Null -- used to support Null values Char -- unicode type that auto-trims trailing whitespace, and ignores trailing whitespace for comparisons Date -- date object that allows for no date DateTime -- datetime object that allows for no datetime Time -- time object that allows for no time Logical -- adds Unknown state to bool's: instead of True/False/None, values are Truth, Falsth, and Unknown, with appropriate tri-state logic; just as bool(None) is False, bool(Unknown) is also False; the numerical values of Falsth, Truth, and Unknown is 0, 1, 2 Quantum -- similar to Logical, but implements boolean algebra (I think). Has states of Off, On, and Other. Other has no boolean nor numerical value, and attempts to use it as such will raise an exception Whirlwind Tour -- import datetime import dbf table = dbf.Table( filename='test', field_specs='name C(25); age N(3,0); birth D; qualified L', on_disk=False, ) table.open() for datum in ( ('Spanky', 7, dbf.Date.fromymd('20010315'), False), ('Spunky', 23, dbf.Date(1989, 07, 23), True), ('Sparky', 99, dbf.Date(), dbf.Unknown), ): table.append(datum) for record in table: print record print '' print record[0:3] print record['name':'qualified'] print [record.name, record.age, record.birth] print '' custom = table.new( filename='test_on_disk', default_data_types=dict(C=dbf.Char, D=dbf.Date, L=dbf.Logical), ) with custom:# automatically opened and closed for record in table: custom.append(record) for record in custom: dbf.write(record, name=record.name.upper()) print record print '' print record[0:3] print record['name':'qualified'] print [record.name, record.age, record.birth] print '' table.close() -- https://mail.python.org/mailman/listinfo/python-list
Re: [ANN] dbf v0.96 is released
On 2014-10-28 12:53, Ethan Furman wrote: dbf (also known as python dbase) is a module for reading/writing dBase III, FP, VFP, and Clipper .dbf database files. It's an ancient format that still finds lots of use Just a little note to give thanks for all the work you put into such an unglamorous-yet-backside-saving project. It *is* appreciated by those of us who have had to disinter data from old client .dbf files. -tkc -- https://mail.python.org/mailman/listinfo/python-list
Re: [ANN] dbf v0.96 is released
On 10/28/2014 01:08 PM, Tim Chase wrote: Just a little note to give thanks for all the work you put into such an unglamorous-yet-backside-saving project. It *is* appreciated by those of us who have had to disinter data from old client .dbf files. Thank you! :) -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list
Re: [ANN] dbf v0.96 is released
dbf === dbf (also known as python dbase) is a module for reading/writing dBase III, FP, VFP, and Clipper .dbf database files. Available via PyPI at ? https://pypi.python.org/pypi/dbf/0.96.001 -- Stanley C. Kitching Human Being Phoenix, Arizona -- https://mail.python.org/mailman/listinfo/python-list
Re: Build Question: How to Add -Wl, --option Before Objects In Setup.py?
On Tue, Oct 28, 2014 at 3:11 AM, Ned Deily n...@acm.org wrote: In article CAHu5PrY-T=DT3wOg-Y+Va9WgwBV3w9d7M-tu=_n-cngwssz...@mail.gmail.com, Cyd Haselton chasel...@gmail.com wrote: [...] I'm building python on an Android device in the KBOX environment...which simulates a Unix type filesystem. Python isn't installed; I'm building from sources (2.7.8) with GCC 4.8.0 and make. The problem with the LDFLAGS approach is that some of the libraries that must be linked (-lc -ldl) do not need the --allow-shlib-undefined option...it's only the lpython2.7 that does. Any way to do this? Sorry, I have no experience with that environment nor an understanding of why you need to specify --allow-shlib-undefined (it seems to be the default in some versions of ld). You could look at and, if necessary, modify Lib/distutils, the part of the Python standard library that builds extension modules from setup.py. -- Ned Deily, n...@acm.org -- https://mail.python.org/mailman/listinfo/python-list No need to apologize. Also no need to have an understanding of the environment; with a few rare exceptions it behaves just like a Unix/Linux one. The reason why I need to specify --allow-shlib-undefined is for the python library; it's throwing undefined references to sincos even though the symbol is there. Specifying that option is the only fix I've found. As mentioned earlier, i'm not familiar with python or its build system; which file in the distutils dir do I need to modify? -- https://mail.python.org/mailman/listinfo/python-list
Re: [ANN] dbf v0.96 is released
On 10/28/2014 01:34 PM, Cousin Stanley wrote: dbf === dbf (also known as python dbase) is a module for reading/writing dBase III, FP, VFP, and Clipper .dbf database files. Available via PyPI at ? https://pypi.python.org/pypi/dbf/0.96.001 Ah, yes, that's the place! Although I usually leave off the version so the link is always to the most recent: https://pypi.python.org/pypi/dbf -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list
Re: Build Question: How to Add -Wl, --option Before Objects In Setup.py?
In article cahu5pra68edgkvfyhtq+srmb6syew9a1sabb5cemluzqbs5...@mail.gmail.com, Cyd Haselton chasel...@gmail.com wrote: On Tue, Oct 28, 2014 at 3:11 AM, Ned Deily n...@acm.org wrote: In article CAHu5PrY-T=DT3wOg-Y+Va9WgwBV3w9d7M-tu=_n-cngwssz...@mail.gmail.com, Cyd Haselton chasel...@gmail.com wrote: [...] I'm building python on an Android device in the KBOX environment...which simulates a Unix type filesystem. Python isn't installed; I'm building from sources (2.7.8) with GCC 4.8.0 and make. The problem with the LDFLAGS approach is that some of the libraries that must be linked (-lc -ldl) do not need the --allow-shlib-undefined option...it's only the lpython2.7 that does. Any way to do this? Sorry, I have no experience with that environment nor an understanding of why you need to specify --allow-shlib-undefined (it seems to be the default in some versions of ld). You could look at and, if necessary, modify Lib/distutils, the part of the Python standard library that builds extension modules from setup.py. No need to apologize. Also no need to have an understanding of the environment; with a few rare exceptions it behaves just like a Unix/Linux one. The reason why I need to specify --allow-shlib-undefined is for the python library; it's throwing undefined references to sincos even though the symbol is there. Specifying that option is the only fix I've found. As mentioned earlier, i'm not familiar with python or its build system; which file in the distutils dir do I need to modify? Perhaps I should apologize for not asking earlier what you are really trying to do before suggesting heading down the path of modifying Distutils :) So the issue is with an undefined reference to sincos? It appears that that routine is often supplied in libm. Is that the case on your platform? And, if so, the right fix might be to supply it manually or, better, ensure that Python supplies it as a result of running ./configure. Also, what version of Python are you building? -- Ned Deily, n...@acm.org -- https://mail.python.org/mailman/listinfo/python-list
Python 3.4.2 + PyQt4 + PyCharm 3.4.1
Python 3.4.2 Windows x64 PyQt4 4.11.2 Py3.4 Qt4.8.6 (x64) PyCharm 3.4.1 Pro Edition So, PyCharm works 100% with everything here but PyQt. I have this folder structure: Disk C: PyQt4 Lib/site-packages/PyQt4/(tons of files here) Python34 (normal/default installation) --- I tried copying the 'PyQt4' folder to my 'Python34/Lib/site-packages' folder but when I try to code something Qt related on PyCharm I get this issue: Some skeletons failed to generate: 19 modules failed in 1 interpreter. Details... Failed modules Python 3.4.2 PyQt4.QAxContainer PyQt4.Qsci PyQt4.QtCore PyQt4.QtDeclarative PyQt4.QtDesigner PyQt4.QtGui PyQt4.QtHelp PyQt4.QtMultimedia PyQt4.QtNetwork PyQt4.QtOpenGL PyQt4.QtScript PyQt4.QtScriptTools PyQt4.QtSql PyQt4.QtSvg PyQt4.QtTest PyQt4.QtWebKit PyQt4.QtXml PyQt4.QtXmlPatterns PyQt4.phonon Generation of skeletons for the modules above will be tried again when the modules are updated or a new version of generator is available. And PyCharm tells me that my 'import PyQt4.ANYTHING_HERE import *' has 'Unresolved references'. --- When I try to install the PyQt4 via the installer, in the default location (C:/Python34) I get an even 'worse' error, whenever PyCharm try to update the skeletons or something like that (that is, whenever I open a file there...), I get tons and tons of the same error, 'Error while accessing memory at address ', and 'python.exe' stops working. -- https://mail.python.org/mailman/listinfo/python-list
% symbol in python
trthkeytdinput type=text name=key value=%(key)s rowhtml = 'trth%stdinput type=text name=%s value%%(%s)s\n what does % mean in first line of code and what does %%(%s)s mean in second line of code kindly explain -- https://mail.python.org/mailman/listinfo/python-list
Re: % symbol in python
On 28/10/2014 21:41, satishmlm...@gmail.com wrote: trthkeytdinput type=text name=key value=%(key)s rowhtml = 'trth%stdinput type=text name=%s value%%(%s)s\n what does % mean in first line of code and what does %%(%s)s mean in second line of code kindly explain Please refer to https://docs.python.org/3/library/stdtypes.html#printf-style-string-formatting -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence -- https://mail.python.org/mailman/listinfo/python-list
checking whether a string is text or binary
I'm an English major who hacks scripts together to do things as needed. I used this code from the Python Cookbook for years. https://www.safaribooksonline.com/library/view/python-cookbook-2nd/0596007973/ch01s12.html Especially when I need to convert old WPD files to markdown, some of which don't even have file extensions, so the code helps determine what kind of file it is I am reading in conversion scripts. I tried to convert the code using 2to3 and it broke. The error I get when using Python 3 is on this line: _null_trans = string.maketrans(, ) and the error reads AttributeError: 'module' object has no attribute 'maketrans' Any help? I barely understand the whole unicode business, but any guidance in updating the code would be much appreciated. THANKS Rick -- https://mail.python.org/mailman/listinfo/python-list
Re: checking whether a string is text or binary
On Tue, Oct 28, 2014 at 3:21 PM, Rick Dooling rpdool...@gmail.com wrote: I tried to convert the code using 2to3 and it broke. The error I get when using Python 3 is on this line: _null_trans = string.maketrans(, ) and the error reads AttributeError: 'module' object has no attribute 'maketrans' Any help? I barely understand the whole unicode business, but any guidance in updating the code would be much appreciated. Top hit on python3 maketrans in Google: http://stackoverflow.com/questions/3031045/how-come-string-maketrans-does-not-work-in-python-3-1 -- https://mail.python.org/mailman/listinfo/python-list
Re: checking whether a string is text or binary
On Tuesday, October 28, 2014 5:30:31 PM UTC-5, Dan Stromberg wrote: On Tue, Oct 28, 2014 at 3:21 PM, Rick Dooling wrote: I tried to convert the code using 2to3 and it broke. The error I get when using Python 3 is on this line: _null_trans = string.maketrans(, ) and the error reads AttributeError: 'module' object has no attribute 'maketrans' Any help? I barely understand the whole unicode business, but any guidance in updating the code would be much appreciated. Top hit on python3 maketrans in Google: http://stackoverflow.com/questions/3031045/how-come-string-maketrans-does-not-work-in-python-3-1 THANK YOU I read that twice before without being able to figure what I needed to change, but third time is a charm. Rick -- https://mail.python.org/mailman/listinfo/python-list
Re: Anyone know the solution
On 28Oct2014 09:07, ngangsia akumbo ngang...@gmail.com wrote: This is a sample code on how to read data from a file files1 {} result = open(file1.txt) for line in result: file1 = linesplit() files1.append(file1) result.close() file1.sort() file1.reverse() print('THE FILE INFO') print(file1(0) print(file1(1) Do you have a specific question to accompany this? The code above is syntactly invalid, so it will not run. The line: files1 {} is invalid, but looks like it is intended to initialise files1 as a dictionary. However, the rest of the program seems to use it as though it were a list. The line: file1 = linesplit() should probably be written: file1 = line.split() With it is legal (as it performs a comparison) but will fail because there's no bare split() function, and anyway is probably not as intended. Your final print statements need an extra closing parenthesis each. Cheers, Cameron Simpson c...@zip.com.au I fit in my suit, my suit fits in my suitcase, hence i fit in my suitcase. - Cees Keyer c...@htsa.hva.nl -- https://mail.python.org/mailman/listinfo/python-list
Re: Anyone know the solution
On Monday, October 27, 2014 5:33:17 PM UTC-7, alex23 wrote: On 28/10/2014 1:10 AM, e...@gmail.com wrote: Write a program that reads the contents of the two files into two separate lists. The user should be able to enter a boy's name, a girl's name or both, and the application will display messages indicating whether the names were among the most popular. This is actually a trick question. This is a classic unsolvable problem in computer science, known as the Dual Baskets problem. It is NP-complete, meaning that there is no easy solution. It requires brute-forcing and can take an indefinite period of time to complete, if at all. The correct answer is Not possible. Can you elaborate why it is an NP-complete problem or maybe a link to description of problem you are referring to? Thanks. -- https://mail.python.org/mailman/listinfo/python-list
Re: www.python.org
Hi Pythonistas, On behalf of all Australians, I would like to apologise for this ill advised SEO spam. Embarrassed, Cameron Simpson c...@zip.com.au On 28Oct2014 08:48, Eileen | Cellsix Pty Ltd eileenjthomps...@gmail.com wrote: Hi, I recently browsed through your business website and wanted to highlight some key points for consideration. I am sure it will complement your-S.E.O. work to help your website attract only quality visitors and make it scale high on the search .engine results page (SERP) gradually. Would you be interested in receiving the details? Best regards, Eileen Online-Strategist CELLsIX MEDIA PTY LTD. Headquarters: Office 7003 X2 Tower, Cluster X, Melbourne Vic. 3000 Australia Other Branches: Sydney | Perth | Brisbane | Adelaide | Hobart Disclaimer: This e-mail is private and confidential. If you are not the intended recipient, please advise us by return e-mail immediately, and delete the e-mail and any attachments without using or disclosing the contents in any way. The views expressed in this e-mail are those of the author, and do not represent those of this company unless this is clearly indicated. You should scan this e-mail and any attachments for viruses. This company accepts no liability for any direct or indirect damage or loss resulting from the use of any attachments to this e-mail. All quotes received from Cellsix Media by email are informal and not binding until a formal quote is agreed upon by both the parties. -- https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list
Re:% symbol in python
satishmlm...@gmail.com Wrote in message: trthkeytdinput type=text name=key value=%(key)s rowhtml = 'trth%stdinput type=text name=%s value%%(%s)s\n what does % mean in first line of code and what does %%(%s)s mean in second line of code kindly explain Please post Python code, and we can try to comment on it. Those extra tr and th thingies are really killing my mental syntax checker. Also, always specify the python version. -- DaveA -- https://mail.python.org/mailman/listinfo/python-list
Re: Anyone know the solution
On 29/10/2014 11:28 AM, Anton wrote: Can you elaborate why it is an NP-complete problem or maybe a link to description of problem you are referring to? While not the exact problem, it's tangentially related to: http://kenlevine.blogspot.com.au/2011/03/reducing-humor-to-equation.html -- https://mail.python.org/mailman/listinfo/python-list
Re: Anyone know the solution
Cameron Simpson c...@zip.com.au Wrote in message: On 28Oct2014 09:07, ngangsia akumbo ngang...@gmail.com wrote: This is a sample code on how to read data from a file files1 {} result = open(file1.txt) for line in result: file1 = linesplit() files1.append(file1) result.close() file1.sort() file1.reverse() print('THE FILE INFO') print(file1(0) print(file1(1) Do you have a specific question to accompany this? The code above is syntactly invalid, so it will not run. Your final print statements need an extra closing parenthesis each. Other comments - The line that appends probably wants to be in the loop, and is not. Is there a reason you're subsequently processing only the last line? -- DaveA -- https://mail.python.org/mailman/listinfo/python-list
Re: Regex substitution trouble
On 28Oct2014 04:02, massi_...@msn.com massi_...@msn.com wrote: I'm not really sure if this is the right place to ask about regular expressions, but since I'm usin python I thought I could give a try :-) Here is the problem, I'm trying to write a regex in order to substitute all the occurences in the form $somechars with another string. This is what I wrote: newstring = re.sub(ur(?u)(\$\[\s\w]+\), subst, oldstring) This works pretty well, but it has a problem, I would need it also to handle the case in which the internal string contains the double quotes, but only if preceeded by a backslash, that is something like $somechars_with\\doublequotes. Can anyone help me to correct it? People seem to be making this harder than it should be. I'd just be fixing up your definition of what's inside the quotes. There seem to be 3 kinds of things: - not a double quote or backslash - a backslash followed by a double quote - a backslash followed by not a double quote Kind 3 is a policy call - take the following character or not? I would go with treating it like kind 2 myself. So you have: 1 [^\\] 2 \\ 3 \\[^] and fold 2 and 3 into: 2+3 \\. So your regexp inner becomes: ([^\\]|\\.)* and the whole thing becomes: \$(([^\\]|\\.)*) and as a raw string: ur'\$(([^\\]|\\.)*)' choosing single quotes to be more readable given the double quotes in the regexp. Cheers, Cameron Simpson c...@zip.com.au -- cat: /Users/cameron/rc/mail/signature.: No such file or directory Language... has created the word loneliness to express the pain of being alone. And it has created the word solitude to express the glory of being alone. - Paul Johannes Tillich -- https://mail.python.org/mailman/listinfo/python-list
Re: A bug?
On Tue, 28 Oct 2014 01:29:28 +, Joshua Landau wrote: On 28 October 2014 00:36, Denis McMahon denismfmcma...@gmail.com wrote: d = [[list(range(1,13))[i*3+j] for j in range(3)] for i in range(4)] A quick note. Ranges (even 2.7's xrange) are all indexable. The cast to a list isn't needed. Until you apply Chris' slicing trick, and then: [list(range(1,13))[i*3:i*3+3] for i in range(4)] [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]] [range(1,13)[i*3:i*3+3] for i in range(4)] [range(1, 4), range(4, 7), range(7, 10), range(10, 13)] Depends how important it is that you get a list and not a range object ;) (Thinking back to a recent discussion where someone was taking str(range (x)) and not getting the expected results) -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list
Re: memory, PE files, etc...
On Mon, 27 Oct 2014 10:16:43 -0700, kiuhnm03 wrote: I'd like to write one or more scripts that analyze processes in memory on Windows 7. I used to do these things in C++ by using native Win32 API calls. How should I proceed in python? Any pointers? This seems to be a very common request. Does anyone know why? -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list
Re: memory, PE files, etc...
On Wed, Oct 29, 2014 at 1:18 PM, Denis McMahon denismfmcma...@gmail.com wrote: On Mon, 27 Oct 2014 10:16:43 -0700, kiuhnm03 wrote: I'd like to write one or more scripts that analyze processes in memory on Windows 7. I used to do these things in C++ by using native Win32 API calls. How should I proceed in python? Any pointers? This seems to be a very common request. Does anyone know why? I hadn't noticed it as hugely common, but in any case... I'd say it's because ctypes and pywin32 are (rightly) obscure, so people don't know they can basically do the same thing in Python as in C++. That's what python-list is for, I think. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
What for -- for? (was A bug?)
On Wednesday, October 29, 2014 7:47:47 AM UTC+5:30, Denis McMahon wrote: On Tue, 28 Oct 2014 01:29:28 +, Joshua Landau wrote: On 28 October 2014 00:36, Denis McMahon wrote: d = [[list(range(1,13))[i*3+j] for j in range(3)] for i in range(4)] A quick note. Ranges (even 2.7's xrange) are all indexable. The cast to a list isn't needed. Until you apply Chris' slicing trick, and then: [list(range(1,13))[i*3:i*3+3] for i in range(4)] [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]] [range(1,13)[i*3:i*3+3] for i in range(4)] [range(1, 4), range(4, 7), range(7, 10), range(10, 13)] Depends how important it is that you get a list and not a range object ;) Heh! Strange that you say this in this context! Yesterday I was trying to introduce python to some senior computer scientists. Tried showing a comprehension-based dir-walker vs a for-loop based one: def dw(p): if isfile(p): return [p] else: return [p] + [c for f in listdir(p) for c in dw(p+'/'+f)] def dw(p): if isfile(p): return [p] else: ls = [p] for f in listdir(p): ls = ls+[f] for c in dw(p+'/'+f): ls = ls+[c] return ls Comment to me : Well this is neat and compact, but it does not add anything fundamental (over usual index based for-loops) I tried to say that 'for' over general sequences is quite different and significantly more powerful than C/Pascal for over indexes + explicit indexing. In particular the fact that in python-3: range(1,10) range(1, 10) and not like python2's range(1,10) [1, 2, 3, 4, 5, 6, 7, 8, 9] seemed to convincingly show that python's range is just 'notional' like Pascal's subrange types and not an actual sequence. That range(10)+range(10) works in python 2 but not 3 does not help my case at all! I'd be interested in thoughts on this -- is a range a 'real' or a 'notional' sequence? Related point: A range is a sequence How to prove this introspectively? ie if I do: type([]).__mro__ (class 'list', class 'object') type(range(10)).__mro__ (class 'range', class 'object') How to see that list and range are both sequences? Or more generally how to to introspectively discover (ie not by reading docs!!) the abstract base classes -- eg sequence, iterable etc -- for an arbitrary object? -- https://mail.python.org/mailman/listinfo/python-list
Re: % symbol in python
import cgi, shelve, sys, os shelvename = 'class-shelve' fieldnames = ('name', 'age', 'job', 'pay') form = cgi.FieldStorage() print('Content-type: text/html') sys.path.insert(0, os.getcwd()) replyhtml = html titlePeople Input Form/title body form method=POST action=peoplecgi.py table trthkeytdinput type=text name=key value=%(key)s $ROWS$ /table p input type=submit value=Fetch, name=action input type=submit value=Update, name=action /form /body/html rowhtml = 'trth%stdinput type=text name=%s value=%%(%s)s\n' rowshtml = '' for fieldname in fieldnames: rowshtml += (rowhtml % ((fieldname, ) * 3)) replyhtml = replyhtml.replace('$ROWS$', rowshtml) def htmlize(adict): new = adict.copy() for field in fieldnames: value = new[field] new[field] = cgi.escape(repr(value)) return new def fetchRecord(db, form): try: key = form['key'].value record = db[key] fields = record.__dict__ fields['key'] = key except: fields = dict.fromkeys(fieldnames, '?') fields['key'] = 'Missing or invalid key!' return fields def updateRecord(db, form): if not 'key' in form: fields = dict.fromkeys(fieldnames, '?') fields['key'] = 'Missing key input!' else: key = form['key'].value if key in db: record = db[key] else: from person import Person record = Person(name='?', age='?') for field in fieldnames: setattr(record, field, eval(form[field].value)) db[key] = record fields = record.__dict__ fields['key'] = key return fields db = shelve.open(shelvename) action = form['action'].value if 'action' in form else None if action == 'Fetch': fields = fetchRecord(db, form) elif action == 'Update': fields = updateRecord(db, form) else: fields = dict.fromkeys(fieldnames, '?') fields['key'] = 'Missing or invalid action!' db.close() print(replyhtml % htmlize(fields)) -- https://mail.python.org/mailman/listinfo/python-list
Re: % symbol in python
On Wed, Oct 29, 2014 at 2:51 PM, satishmlm...@gmail.com wrote: def fetchRecord(db, form): try: key = form['key'].value When you paste Python code into an email, it's absolutely crucial that you maintain formatting. The indentation is significant. Can you paste it again, please? ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: What for -- for? (was A bug?)
On Tue, Oct 28, 2014 at 10:22 PM, Rustom Mody rustompm...@gmail.com wrote: How to see that list and range are both sequences? Or more generally how to to introspectively discover (ie not by reading docs!!) the abstract base classes -- eg sequence, iterable etc -- for an arbitrary object? # Python 2/3 compatible. Combine with pprint for nice interactive output try: from collections import abc except ImportError: import collections as abc def get_abc_map(cls): return {n: issubclass(cls, getattr(abc, n)) for n in dir(abc) if n[0].isupper()} -- Zach -- https://mail.python.org/mailman/listinfo/python-list
Re: What for -- for? (was A bug?)
On Tue, Oct 28, 2014 at 11:16 PM, Zachary Ware zachary.ware+pyl...@gmail.com wrote: def get_abc_map(cls): return {n: issubclass(cls, getattr(abc, n)) for n in dir(abc) if n[0].isupper()} Of course, Gmail decided to wrap my long line for me. In case it's not obvious, that should be a single line. -- Zach -- https://mail.python.org/mailman/listinfo/python-list
Re: What for -- for? (was A bug?)
On Wednesday, October 29, 2014 9:53:46 AM UTC+5:30, Zachary Ware wrote: On Tue, Oct 28, 2014 at 11:16 PM, Zachary Ware wrote: def get_abc_map(cls): return {n: issubclass(cls, getattr(abc, n)) for n in dir(abc) if n[0].isupper()} Of course, Gmail decided to wrap my long line for me. In case it's not obvious, that should be a single line. Thanks Wrapping -- no problem. But the isupper looks like black-magic :-) And removing the ' ... if n[0].isupper()' breaks the code -- https://mail.python.org/mailman/listinfo/python-list
Re: % symbol in python
import cgi, shelve, sys, os shelvename = 'class-shelve' fieldnames = ('name', 'age', 'job', 'pay') form = cgi.FieldStorage() print('Content-type: text/html') sys.path.insert(0, os.getcwd()) replyhtml = html titlePeople Input Form/title body form method=POST action=peoplecgi.py table trthkeytdinput type=text name=key value=%(key)s $ROWS$ /table p input type=submit value=Fetch, name=action input type=submit value=Update, name=action /form /body/html rowhtml = 'trth%stdinput type=text name=%s value=%%(%s)s\n' rowshtml = '' for fieldname in fieldnames: rowshtml += (rowhtml % ((fieldname, ) * 3)) replyhtml = replyhtml.replace('$ROWS$', rowshtml) def htmlize(adict): new = adict.copy() for field in fieldnames: value = new[field] new[field] = cgi.escape(repr(value)) return new def fetchRecord(db, form): try: key = form['key'].value record = db[key] fields = record.__dict__ fields['key'] = key except: fields = dict.fromkeys(fieldnames, '?') fields['key'] = 'Missing or invalid key!' return fields def updateRecord(db, form): if not 'key' in form: fields = dict.fromkeys(fieldnames, '?') fields['key'] = 'Missing key input!' else: key = form['key'].value if key in db: record = db[key] else: from person import Person record = Person(name='?', age='?') for field in fieldnames: setattr(record, field, eval(form[field].value)) db[key] = record fields = record.__dict__ fields['key'] = key return fields db = shelve.open(shelvename) action = form['action'].value if 'action' in form else None if action == 'Fetch': fields = fetchRecord(db, form) elif action == 'Update': fields = updateRecord(db, form) else: fields = dict.fromkeys(fieldnames, '?') fields['key'] = 'Missing or invalid action!' db.close() print(replyhtml % htmlize(fields)) kindly let me know what is $ROWS$ along with % symbol's meaning -- https://mail.python.org/mailman/listinfo/python-list
Re: What for -- for? (was A bug?)
On Tue, Oct 28, 2014 at 11:40 PM, Rustom Mody rustompm...@gmail.com wrote: On Wednesday, October 29, 2014 9:53:46 AM UTC+5:30, Zachary Ware wrote: On Tue, Oct 28, 2014 at 11:16 PM, Zachary Ware wrote: def get_abc_map(cls): return {n: issubclass(cls, getattr(abc, n)) for n in dir(abc) if n[0].isupper()} Of course, Gmail decided to wrap my long line for me. In case it's not obvious, that should be a single line. Thanks Wrapping -- no problem. But the isupper looks like black-magic :-) And removing the ' ... if n[0].isupper()' breaks the code It's a terrible hack for 2/3 compatibility; in 3 I'd do if not n.startswith('__') since the Python 3 collections.abc module only contains ABCs (and the standard dunder names). Python 2 has all the ABCs mixed into the toplevel collections namespace with some other non-ABCs, but it happens that all the ABCs are capitalized, while the non-ABCs are not. The ABCs are imported into collections from _abcoll, but _abcoll also some uncapitalized non-ABCs as well. For somewhat greyer magic, do 'from abc import ABCMeta' and filter the collections.abc namespace with isinstance(obj, ABCMeta). I just used the above because it's short and sweet and keeps the name handy :) -- Zach -- https://mail.python.org/mailman/listinfo/python-list
.write() behavior
Marko Rauhamaa ma...@pacujo.net writes: Marko Rauhamaa ma...@pacujo.net: Actually, that's mistaken as well. The sys.std* handles and pipes returned by subprocess are accessed using file.write() and thus may return partial writes. I find this very surprising. In Python 2, where file.write() seems to always return None, are you telling me that a call to file.write() might silently return after only writing _some_ of my output? Without raising an exception or returning any other indication of failure? How am I supposed to defend myself against that? You might be right, because nothing in the Python 2 documentation I can find _explicitly_ says that file.write() is guaranteed to write everything I told it to, but that seems like a sufficiently surprising fact that I would expect the documentation to emphasize the danger. In Python 3 the situation is more puzzling: The documentation for open() explains that the type of object returned depends on the mode argument, and several possible candidates for the class of the file object returned are mentioned. Some of those classes document a .write() method that may indeed perform a partial write and return a count of how far it got. Other classes don't say that they might do partial writes, but neither do they say that they don't do partial writes. It seems possible that the _intent_ is that text mode opens return a file object that guarantees to always do a full write. But maybe not. OK, so maybe the situation is that in Python 2 file.write() is guaranteed to never do a partial write and that in Python 3 there are no such guarantees. That seems like a big change to watch out for when migrating my code from 2 to 3. But I can't seem to find any warnings about that in the Python 3 documentation. Just to be clear here, are you saying that in Python 3, I have to start using a utility like: def guaranteed_write(file, data): while data: n = file.write(data) if n len(data): data = data[n:] else: return for any file object returned by open()? Or maybe just for file objects opened in binary mode? Am I missing something? There seem to be some primitive IO facilities in Python 3 that make a distinction between blocking and non-blocking mode, but that distinction doesn't seem to be available when I just call open(). Maybe there is some design document for Python 3 IO that I should read that would explain the rationale for all this? -- Alan Bawden -- https://mail.python.org/mailman/listinfo/python-list
Re: Anyone know the solution
On Monday, October 27, 2014 5:33:17 PM UTC-7, alex23 wrote: It is NP-complete, meaning that there is no easy solution. The correct answer is Not possible. No, that's not the correct answer. Being NP-complete doesn't mean something is impossible, or even hard to do. All it means is that nobody knows of a cleverer solution than just trying all possibilities. That's only a difficulty if the problem is large enough; often it won't be. -- Greg -- https://mail.python.org/mailman/listinfo/python-list
Re: What for -- for? (was A bug?)
On Wednesday, October 29, 2014 10:29:48 AM UTC+5:30, Zachary Ware wrote: On Tue, Oct 28, 2014 at 11:40 PM, Rustom Mody wrote: On Wednesday, October 29, 2014 9:53:46 AM UTC+5:30, Zachary Ware wrote: On Tue, Oct 28, 2014 at 11:16 PM, Zachary Ware wrote: def get_abc_map(cls): return {n: issubclass(cls, getattr(abc, n)) for n in dir(abc) if n[0].isupper()} Of course, Gmail decided to wrap my long line for me. In case it's not obvious, that should be a single line. Thanks Wrapping -- no problem. But the isupper looks like black-magic :-) And removing the ' ... if n[0].isupper()' breaks the code It's a terrible hack for 2/3 compatibility; in 3 I'd do if not n.startswith('__') since the Python 3 collections.abc module only contains ABCs (and the standard dunder names). Python 2 has all the ABCs mixed into the toplevel collections namespace with some other non-ABCs, but it happens that all the ABCs are capitalized, while the non-ABCs are not. The ABCs are imported into collections from _abcoll, but _abcoll also some uncapitalized non-ABCs as well. For somewhat greyer magic, do 'from abc import ABCMeta' and filter the collections.abc namespace with isinstance(obj, ABCMeta). I just used the above because it's short and sweet and keeps the name handy :) Ha! Thanks Maybe nicer to filter out the false's with a filter-false thus?? def ff(d): return [n for n in d if d[n]] -- https://mail.python.org/mailman/listinfo/python-list
Re: What for -- for? (was A bug?)
Zachary Ware zachary.ware+pyl...@gmail.com writes: Of course, Gmail decided to wrap my long line for me. In case it's not obvious, that should be a single line. Right, GMail is a poor choice for composing messages. You might get better results installing a proper mail client, and communicating via IMAP. -- \“Pinky, are you pondering what I'm pondering?” “Wuh, I think | `\ so, Brain, but how will we get three pink flamingos into one | _o__) pair of Capri pants?” —_Pinky and The Brain_ | Ben Finney -- https://mail.python.org/mailman/listinfo/python-list
Re: % symbol in python
On 29/10/2014 2:41 PM, satishmlm...@gmail.com wrote: kindly let me know what is $ROWS$ along with % symbol's meaning It's a token, a static value added to the template to indicate where additional data will be added. So $ROW$ in this section: table trthkeytdinput type=text name=key value=%(key)s $ROWS$ /table Will be replaced by whatever rowshtml contains at this point: replyhtml = replyhtml.replace('$ROWS$', rowshtml) Of note: the template section above has opening tags for tr, th and td but no closing ones. It's not valid html. Also I don't think this is doing what you think it is: rowhtml = 'trth%stdinput type=text name=%s value=%%(%s)s\n' rowshtml = '' for fieldname in fieldnames: rowshtml += (rowhtml % ((fieldname, ) * 3)) replyhtml = replyhtml.replace('$ROWS$', rowshtml) After the first fieldname ('name' in this case), the token $ROWS$ will be replaced by the string : 'trthnametdinput type=text name=name value=%%(name)s\n'. On the second iteration of the loop, when fieldname is 'age', rowshtml will equal: 'trthnametdinput type=text name=name value=%%(name)s\ntrthagetdinput type=text name=age value=%%(age)s\n' ...but nothing will happen with it as $ROWS$ has already been replaced during the first time through the loop. Either the `replyhtml = ...` line is mis-indented or the code is terribly broken. Unless this is for homework, I highly recommend just using one of the many templating libraries that exist for Python, such as Jinja2. -- https://mail.python.org/mailman/listinfo/python-list
Re: What for -- for? (was A bug?)
On Wed, Oct 29, 2014 at 12:15 AM, Rustom Mody rustompm...@gmail.com wrote: Maybe nicer to filter out the false's with a filter-false thus?? def ff(d): return [n for n in d if d[n]] Sure. Or, combining things: try: from collections import abc except ImportError: import collections as abc from abc import ABCMeta abcs = [o for o in vars(abc).values() if isinstance(o, ABCMeta)] def get_abcs(cls): return [abc for abc in abcs if issubclass(cls, abc)] def get_abc_names(cls): return [abc.__name__ for abc in get_abcs(cls)] Of course, that's 3 (progressively shorter) loops to get the names of the ABCs of a class compared to 1 (fairly short in the first place) loop for a map of relationships to all available ABCs, but optimizing such a toy as this would just be an exercise in futility :) -- Zach -- https://mail.python.org/mailman/listinfo/python-list
Re: What for -- for? (was A bug?)
On Wed, Oct 29, 2014 at 12:27 AM, Ben Finney ben+pyt...@benfinney.id.au wrote: Zachary Ware zachary.ware+pyl...@gmail.com writes: Of course, Gmail decided to wrap my long line for me. In case it's not obvious, that should be a single line. Right, GMail is a poor choice for composing messages. You might get better results installing a proper mail client, and communicating via IMAP. Noted, but it works fine 99% of the time for me. I'm not really interested in trying to get a proper mail client set up on 5 different devices and 4 different platforms with settings shared between all just to avoid inconvenient line-wrapping (that I can avoid just by sticking to 80 column lines in the first place :). Although if you have a suggestion for that kind of setup, I'm all ears. -- Zach -- https://mail.python.org/mailman/listinfo/python-list
Re: % symbol in python
kindly let me know what does %%(%s)% mean -- https://mail.python.org/mailman/listinfo/python-list
[issue21877] External.bat and pcbuild of tkinter do not match.
Terry J. Reedy added the comment: I am quite aware that the two searches are different. tcl8xyz.dll and tkxyz.dll must be copied from ../tcltk/bin to pcbuild while init.tcl must be left in ../tcltk/lib/tcl8.x, where x is, now, '5' or '6'. Since compiling tcl/tk clears tcltk/, it is impossible to simultaneously run 2.7 which requires tcltk/lib/tcl8.5/init.tcl and 3.4/5 which require tcltk/lib/tcl8.6/init.tcl. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21877 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21877] External.bat and pcbuild of tkinter do not match.
Terry J. Reedy added the comment: Since the two .dlls must now be copied manually (still undocumented?) for tkinter to work, I fail to see the problem with having the copying done automatically in external.bat right after the compile that creates them. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21877 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17896] Move Windows external libs from src\..\ to src\externals
Terry J. Reedy added the comment: I could not find an issue specifically for the tcltk problem. I just explained the problem as I know it in msg230120 of #17896. Some sort of fix is required before we can merge multiple tcltk directories in isolated build directories of the sort you diagrammed in msg214138. -- stage: patch review - needs patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17896 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17846] Building Python on Windows - Supplementary info
Terry J. Reedy added the comment: Because the name 'tcltk' is unversioned and contents rebuilt for each compile, isolated build directories of the sort diagrammed in msg214138 are required if one want to build and run both 2.7, which requires tcl8.5, and 3.4+, which require tcl8.6. Since other dependency subdir names include the version, multiple versions can live in the same dir. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17846 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22749] remove obsolete remark in time.clock() docs
New submission from Akira Li: time.clock() documentation [1] says: this is the function to use for benchmarking Python or timing algorithms. and Deprecated since version 3.3: The behaviour of this function depends on the platform: use perf_counter() or process_time() instead, depending on your requirements, to have a well defined behaviour. [1]: https://hg.python.org/cpython/file/a22ef88143b9/Doc/library/time.rst#l127 The first remark is incorrect since 3.3. I've attached a documentation patch that removes it. -- assignee: docs@python components: Documentation files: docs-time-clock-remove-stale-remark.diff keywords: patch messages: 230124 nosy: akira, docs@python priority: normal severity: normal status: open title: remove obsolete remark in time.clock() docs type: behavior versions: Python 3.3, Python 3.4, Python 3.5, Python 3.6 Added file: http://bugs.python.org/file37048/docs-time-clock-remove-stale-remark.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22749 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22748] Porting Extension Modules to Python 3 documentation mention about PyString_* functions in Python 3
Georg Brandl added the comment: Correct, there are no PyString_ functions in 3.x. -- nosy: +georg.brandl ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22748 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22749] remove obsolete remark in time.clock() docs
Georg Brandl added the comment: LGTM. -- nosy: +georg.brandl ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22749 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22725] improve documentation for enumerate() (built-in function)
Georg Brandl added the comment: rdm: your suggestion sounds good. Note that the argument name is iterable in Py3. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22725 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22736] tutorial links at top, book recommendations at bottom of module documentation
Georg Brandl added the comment: I agree, the see also box is better off near the bottom, probably before the examples. -- nosy: +georg.brandl ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22736 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22177] Incorrect version reported after downgrade
Ezio Melotti added the comment: Can this be closed then? -- resolution: - wont fix status: open - pending ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22177 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22173] Update lib2to3.tests and test_lib2to3 to use test discovery
Ezio Melotti added the comment: LGTM -- nosy: +ezio.melotti stage: patch review - commit review ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22173 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22746] cgitb html: wrong encoding for utf-8
Amaury Forgeot d'Arc added the comment: What about open(..., encoding='latin-1', errors='xmlcharrefreplace') -- nosy: +amaury.forgeotdarc stage: resolved - needs patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22746 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22153] There is no standard TestCase.runTest implementation
Changes by Ezio Melotti ezio.melo...@gmail.com: -- nosy: +rbcollins stage: - patch review versions: +Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22153 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22217] Reprs for zipfile classes
Ezio Melotti added the comment: LGTM -- nosy: +ezio.melotti stage: patch review - commit review ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22217 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22746] cgitb html: wrong encoding for utf-8
Wolfgang Rohdewald added the comment: What about open(..., encoding='latin-1', errors='xmlcharrefreplace') That works fine. I tested with a chinese character 与 But I do not think the application should work around something that cgitb is supposed to handle. More so since the documentation is dead silent about this. You need to use codecs.open instead of open and add those kw arguments. As long as this is not explained in the documentation, I guess it is a bug for everyone not using latin-1. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22746 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22746] cgitb html: wrong encoding for utf-8
Wolfgang Rohdewald added the comment: correction: A bug for everyone using non-ascii characters. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22746 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22233] http.client splits headers on none-\r\n characters
Changes by Ezio Melotti ezio.melo...@gmail.com: -- nosy: +ezio.melotti stage: - needs patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22233 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21877] External.bat and pcbuild of tkinter do not match.
Changes by Mark Lawrence breamore...@yahoo.co.uk: -- nosy: +BreamoreBoy ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21877 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22750] xmlapp.py display bug when validate XML by DTD
New submission from Ferdinand: Code is working, but the TEXT variable is not showing the correct line of the XML file but the the line after correct one : Exemple : [u6v7mr@vl-a-txx-05 Python]$ ./validateXML.py DTD/herve.xml DTD/Tomcat.dtd ERROR: 'I' is not an allowed value for the 'value' attribute at DTD/herve.xml:3:19 TEXT: ' tomcat' XML file is KO [u6v7mr@vl-a-txx-05 Python]$ The line expected is : env value=I/ The corresponding line in the DTD file is this one : !ATTLIST env value (D|F|R|P|Q|A) #REQUIRED Here is the python's content : [u6v7mr@vl-a-txx-05 Python]$ cat validateXML.py #!/usr/bin/python from xml.parsers.xmlproc import xmlproc from xml.parsers.xmlproc import xmlval from xml.parsers.xmlproc import xmldtd def validate_xml(xml_filename, dtd_filename): Validate a given XML file with a given external DTD. If the XML file is not valid, an exception will be printed with an error message. dtd = xmldtd.load_dtd(dtd_filename) parser = xmlproc.XMLProcessor() parser.set_application(xmlval.ValidatingApp(dtd, parser)) parser.dtd = dtd parser.ent = dtd try : parser.parse_resource(xml_filename) except : print XML file is KO return 0 print XML file is OK if __name__ == __main__: import sys xml_filename, dtd_filename = sys.argv[1], sys.argv[2] validate_xml(xml_filename, dtd_filename) [u6v7mr@vl-a-txx-05 Python]$ Here is the XML file with the error for the element env : [u6v7mr@vl-a-txx-05 Python]$ cat DTD/herve.xml ?xml version='1.0' encoding='utf-8'? config env value=I/ tomcat count=1 start=1 step=1 adresseIP=10.108.250.72 offset=10 name=HERVE_R_NM_GEN shutdown_port=40010 jvm memory verbosegc=true logrotategc=true min=512 max=1024 /memory permgen max=128 min=128 /permgen /jvm /tomcat tomcat count=1 start=2 step=1 adresseIP=10.108.250.72 offset=20 name=HERVE_R_NM_GEN shutdown_port=40010 jvm memory verbosegc=true logrotategc=true min=512 max=1024 /memory permgen max=128 min=128 /permgen /jvm /tomcat /config [u6v7mr@vl-a-txx-05 Python]$ Here is the stdout expected : [u6v7mr@vl-a-txx-05 Python]$ ./validateXML.py DTD/herve.xml DTD/Tomcat.dtd ERROR: 'I' is not an allowed value for the 'value' attribute at DTD/herve.xml:3:19 TEXT: ' env value=I/' XML file is KO -- components: XML files: Tomcat.dtd messages: 230135 nosy: Spider06 priority: normal severity: normal status: open title: xmlapp.py display bug when validate XML by DTD type: behavior versions: Python 2.7 Added file: http://bugs.python.org/file37049/Tomcat.dtd ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22750 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22751] Fix test___all__ warning about modified environment
New submission from Michael Cetrulo: The following warning is being generated when running test case: Warning -- locale was modified by test___all__ According to the comment there, importing the rlcompleter module changes (or used to change) the locale so after the import it was being set to 'C' This patch reads the current locale before importing and resets it to that value afterwards. -- components: Tests files: locale_envchange_patch.diff keywords: patch messages: 230136 nosy: Michael.Cetrulo, ezio.melotti priority: normal severity: normal status: open title: Fix test___all__ warning about modified environment type: behavior versions: Python 2.7, Python 3.4, Python 3.5, Python 3.6 Added file: http://bugs.python.org/file37050/locale_envchange_patch.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22751 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22153] There is no standard TestCase.runTest implementation
Martin Panter added the comment: The patch seems reasonable to me -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22153 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22232] str.splitlines splitting on non-\r\n characters
Ezio Melotti added the comment: Looks like str.splitlines is using STRINGLIB_ISLINEBREAK which in turn uses Py_UNICODE_ISLINEBREAK, so the behavior should be correct. If splitting on \n, \r, and \r\n only is common enough with might add a bool arg to splitlines to restrict the splitting on those 3 only, but I can't think about any good name for such arg. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22232 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22196] namedtuple documentation could/should mention the new Enum type
Karmen Dykstra added the comment: Updated documentation with Enum example. -- keywords: +patch nosy: +ezio.melotti, kdykstra Added file: http://bugs.python.org/file37051/mywork.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22196 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22237] sorted() docs should state that the sort is stable
Roundup Robot added the comment: New changeset d44f7d229e00 by Ezio Melotti in branch '2.7': #22237: document that sorted() is guaranteed to be stable. Initial patch by Martin Panter. https://hg.python.org/cpython/rev/d44f7d229e00 New changeset 5dd4906daa62 by Ezio Melotti in branch '3.4': #22237: document that sorted() is guaranteed to be stable. Initial patch by Martin Panter. https://hg.python.org/cpython/rev/5dd4906daa62 New changeset b01568e2597e by Ezio Melotti in branch 'default': #22237: merge with 3.4. https://hg.python.org/cpython/rev/b01568e2597e -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22237 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22237] sorted() docs should state that the sort is stable
Ezio Melotti added the comment: Fixed, thanks for the patch! -- assignee: rhettinger - ezio.melotti nosy: +ezio.melotti resolution: - fixed stage: - resolved status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22237 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22594] Add a link to the regex module in re documentation
anupama srinivas murthy added the comment: I have modified the patch and listed the points I know. Could you review it? -- versions: -Python 3.4, Python 3.5 Added file: http://bugs.python.org/file37052/regex-link.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22594 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22232] str.splitlines splitting on non-\r\n characters
Serhiy Storchaka added the comment: With Terry's explanation linebreak looks better to me. Yet one alternative is ascii=False (or unicode=True?). And may be worth to add this parameter to strip/rstrip/lstrip/split too. On other hand regular expressions can be used in such special cases. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22232 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22746] cgitb html: wrong encoding for utf-8
Changes by Serhiy Storchaka storch...@gmail.com: -- nosy: +ezio.melotti, serhiy.storchaka ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22746 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22232] str.splitlines splitting on non-\r\n characters
Ezio Melotti added the comment: There are some ascii line breaks other than \n, \r, \r\n. unicode=True might be better, but might be confused with unicode strings. Maybe unicode_linebreaks or unicode_newlines? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22232 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22237] sorted() docs should state that the sort is stable
Roundup Robot added the comment: New changeset af8f678a4a75 by Ezio Melotti in branch '2.7': #22237: fix patch attribution. https://hg.python.org/cpython/rev/af8f678a4a75 New changeset 2f697bcc8f86 by Ezio Melotti in branch '3.4': #22237: fix patch attribution. https://hg.python.org/cpython/rev/2f697bcc8f86 New changeset 7e870ddd1989 by Ezio Melotti in branch 'default': #22237: merge patch attribution fix. https://hg.python.org/cpython/rev/7e870ddd1989 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22237 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22153] There is no standard TestCase.runTest implementation
Antoine Pitrou added the comment: IMO hiding the existence of `runTest` would be best. It doesn't seem to make anything more flexible, and it complicates the documentation. -- nosy: +pitrou ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22153 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22177] Incorrect version reported after downgrade
Zachary Ware added the comment: I'd say so. -- stage: - resolved status: pending - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22177 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22746] cgitb html: wrong encoding for utf-8
Amaury Forgeot d'Arc added the comment: You need to use codecs.open instead of open No, why? in python3 open() supports the errors handler. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22746 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22242] Doc fix in the Import section in language reference.
Changes by Ezio Melotti ezio.melo...@gmail.com: -- nosy: +brett.cannon stage: - patch review ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22242 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22746] cgitb html: wrong encoding for utf-8
Changes by STINNER Victor victor.stin...@gmail.com: -- components: +Unicode nosy: +haypo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22746 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com