[issue33478] PEP 8 CapWords reference wrong?
Amit Saha <amitsaha...@gmail.com> added the comment: Thanks for the reply. I think I was not clear - the behavior of string.capitalize() is correct as per documentation. But the PEP8 referring to CapWords as cap words case is the bit I am not clear about, since `Capwords` back when you call `string.capwords('CapWords') and not `CapWords`. (Just reopening so that it doesn't get lost) -- status: closed -> open ___ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue33478> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue33478] PEP 8 CapWords reference wrong?
New submission from Amit Saha <amitsaha...@gmail.com>: PEP 8 suggests class names and type variable names to be in CapWords case. However: >>> import string >>> string.capwords('CapWord') 'Capword' Wondering if this this an oversight or am I misunderstanding something? -- assignee: docs@python components: Documentation messages: 316446 nosy: Amit.Saha, docs@python priority: normal severity: normal status: open title: PEP 8 CapWords reference wrong? ___ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue33478> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26323] Add assert_called() and assert_called_once() methods for mock objects
Amit Saha added the comment: Thank you Victor. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26323> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26323] Add assert_called() and assert_called_once() methods for mock objects
Amit Saha added the comment: Thanks Michael, so looks like we are all set for merging this? -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26323> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26323] Add assert_called() and assert_called_once() methods for mock objects
Amit Saha added the comment: Updated patch -- Added file: http://bugs.python.org/file41997/issue26323.patch ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26323> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26323] Add assert_called() and assert_called_once() methods for mock objects
Amit Saha added the comment: @haypo : Just a reminder request to please view the updated patch. -- nosy: +Amit Saha ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26323> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26323] Add assert_called() and assert_called_once() methods for mock objects
Amit Saha added the comment: Updated patch with docs and addressed review comments. -- Added file: http://bugs.python.org/file41961/issue26323.patch ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26323> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26323] Add assert_called() and assert_called_once() methods for mock objects
Changes by Amit Saha <amitsaha...@gmail.com>: -- title: Add a assert_called() method for mock objects -> Add assert_called() and assert_called_once() methods for mock objects ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26323> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26323] Add a assert_called() method for mock objects
Amit Saha added the comment: Updated patch -- Added file: http://bugs.python.org/file41952/issue26323.patch ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26323> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26323] Add a assert_called() method for mock objects
Amit Saha added the comment: Thanks for the review. Updated patch addressing the comments. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26323> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26323] Add a assert_called() method for mock objects
Amit Saha added the comment: Added assert_call_once() -- Added file: http://bugs.python.org/file41946/issue26323.patch ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26323> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26323] Add a assert_called() method for mock objects
Amit Saha added the comment: Thanks for your comments. I am +1 to those additions and would be happy to update the patch. Let me know if I should go ahead. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26323> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26323] Add a assert_called() method for mock objects
Amit Saha added the comment: Please take a look at the attached patch. -- keywords: +patch Added file: http://bugs.python.org/file41903/issue26323.patch ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26323> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26323] Add a assert_called() method for mock objects
Amit Saha added the comment: Fixed the test name -- Added file: http://bugs.python.org/file41904/issue26323.patch ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26323> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26323] Add a assert_called() method for mock objects
Changes by Amit Saha <amitsaha...@gmail.com>: -- type: -> enhancement ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26323> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26323] Add a assert_called() method for mock objects
New submission from Amit Saha: Would a patch for adding a assert_called() method to mocked objects be welcome for inclusion? We do have a assert_not_called() method, so I think this may be a good idea. Please let me know and I will work on it. -- components: Library (Lib) messages: 259960 nosy: Amit.Saha priority: normal severity: normal status: open title: Add a assert_called() method for mock objects ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26323> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Re: input() on python 2.7.5 vs 3.3.2
On Fri, Dec 13, 2013 at 12:45 AM, stephen.bou...@gmail.com wrote: Can someone explain? Thanks. Python 3.3.2 (v3.3.2:d047928ae3f6, May 16 2013, 00:06:53) [MSC v.1600 64 bit (AMD64)] on win32 Type help, copyright, credits or license for more information. x = input() Hello there print(x) Hello there In Python 3, input() considers an input as a string and returns the input as a string. This is the behavior of raw_input() in Python 2. Python 2.7.5 (default, May 15 2013, 22:43:36) [MSC v.1500 32 bit (Intel)] on win32 Type help, copyright, credits or license for more information. x = input() Hello there Traceback (most recent call last): File stdin, line 1, in module File string, line 1 Hello there ^ SyntaxError: unexpected EOF while parsing In Python 2, input() expects valid Python as it's input. If you provide your input as 'Hello there' (a Python string), it won't complain. HTH, Amit. -- http://echorand.me -- https://mail.python.org/mailman/listinfo/python-list
Re: Python application for rpm creation
On Wed, Nov 27, 2013 at 1:39 AM, Unix SA d.josh...@gmail.com wrote: Sounds to me more like he is looking to package some other in house software, as opposed to packaging python specific libraries, etc.. - Yes, This is exactly i am looking at Doing an apt-cache search on my Ubuntu desktop results with a project, Spectacle, coincidentally written in Python. (I haven't really looked into it): http://meego.gitorious.org/meego-developer-tools/spectacle this looks useful, i shall looking to this... or may be try myself writing something. if you guys ( others ) got something else for Redhat Linux rpm creation do let me know. I played with creating a RPM SPEC file generator for Sphinx documentation: https://github.com/amitsaha/sphinx_doc_packaging It's written in Python, so perhaps may help with you a starting point. Best, Amit. -- http://echorand.me -- https://mail.python.org/mailman/listinfo/python-list
Re: How can I get the variable to subtract the input please?
On Tue, Nov 19, 2013 at 9:56 AM, Ed Taylor edtaylo...@gmail.com wrote: This will be very simple to most of you I guess but it's killing me! print (Please type in your age) age = input () leave = 16 print (You have + leave - age + years left at school) I want to have an input where the users age is inserted and then subtracted from the variable age which is set to 16 and the answer displayed as You have x years left at school. I assume you are using Python 3. In that case, the input() function always returns a string: age = input() 10 age '10' age - 10 Traceback (most recent call last): File stdin, line 1, in module TypeError: unsupported operand type(s) for -: 'str' and 'int' And hence you cannot perform a subtraction operation. You will have to convert the input into a data type such as an integer or a float and then try to do any mathematical operation: int(age) - 10 0 float(age)-10 0.0 Hope that helps. Best, Amit. -- http://echorand.me -- https://mail.python.org/mailman/listinfo/python-list
Re: Using try-catch to handle multiple possible file types?
On Tue, Nov 19, 2013 at 5:13 PM, Victor Hooi victorh...@gmail.com wrote: Hi, I have a script that needs to handle input files of different types (uncompressed, gzipped etc.). My question is regarding how I should handle the different cases. My first thought was to use a try-catch block and attempt to open it using the most common filetype, then if that failed, try the next most common type etc. before finally erroring out. So basically, using exception handling for flow-control. However, is that considered bad practice, or un-Pythonic? What other alternative constructs could I also use, and pros and cons? (I was thinking I could also use python-magic which wraps libmagic, or I can just rely on file extensions). Other thoughts? How about starting with a dictionary like this: file_opener = {'.gz': gz_opener, '.txt': text_opener, '.zip': zip_opener} # and so on. where the *_opener are say functions which does the job of actually opening the files. The above dictionary is keyed on file extensions, but perhaps you would be better off using MIME types instead. Assuming you go ahead with using MIME type, how about using python-magic to detect the type and then look in your dictionary above, if there is a corresponding file_opener object. If you get a KeyError, you can raise an exception saying that you cannot handle this file. How does that sound? Best, Amit. -- http://echorand.me -- https://mail.python.org/mailman/listinfo/python-list
[issue17583] IDLE HOWTO
Amit Saha added the comment: Hello, I just wanted to check if I should attach the image files separately and submit the text as a diff? Thanks. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17583 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17854] symmetric difference operation applicable to more than two sets
New submission from Amit Saha: The description of the symmetric difference operation implies that it cannot be applied to more than two sets (http://docs.python.org/3/library/stdtypes.html#set.symmetric_difference). However, this is certainly possible: s={1,2} t={2,3} u={3,4} s^t^u {1, 4} s.symmetric_difference(t).symmetric_difference(u) {1, 4} I am not sure how much of a semantic sense that makes, given that symmetric difference is by definition for two sets. (http://en.wikipedia.org/wiki/Symmetric_difference). So, either the operator should be fixed to allow only two sets or the description be updated. -- assignee: docs@python components: Documentation messages: 187899 nosy: Amit.Saha, docs@python priority: normal severity: normal status: open title: symmetric difference operation applicable to more than two sets type: behavior versions: Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17854 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17854] symmetric difference operation applicable to more than two sets
Amit Saha added the comment: On some more thought, perhaps the description should be updated. Since s^t^u is effectively (s^t)^u and hence the implementation does not violate the definition. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17854 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17854] symmetric difference operation applicable to more than two sets
Amit Saha added the comment: I think the only change I am suggesting is the description of the ^ operator to be something like this: set ^ other ^ .. Return a new set with elements from the sets which are not present in more than one set I do understand that this is not really what the operator and the corresponding operation symmetric_difference() allows semantically. But it does make it consistent with the description of operators such as the | or , but then their operation allows multiple sets semantically. Hmm may be it is fine as it is.. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17854 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17583] IDLE HOWTO
Amit Saha added the comment: I have tried to incorporate most of the suggestions and made some other changes as well. Hope it looks better now. I haven't yet split it into two separate versions. -- Added file: http://bugs.python.org/file29654/idle.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17583 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17583] IDLE HOWTO
Amit Saha added the comment: Hello Éric Araujo, thanks. Oh I thought it did support, and hence I created the diff in exactly the way you mention. i also went ahead and tested it by 'hg import' -ing it into a cpython clone and i was all excited to see all my images there :-) But, yeah I can certainly attach the images separately. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17583 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17583] IDLE HOWTO
Amit Saha added the comment: Thanks Ezio. I am almost done with incorporating the changes suggested and will submit a patch sometime in the next day or so. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17583 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17583] IDLE HOWTO
Amit Saha added the comment: Hi Todd, I just signed the Python contributor agreement electronically. You probably missed the link to the rSt source in my original report. Here it is [1]. I would want this HOWTO to cover all aspects of IDLE from an user's perspective. I have some ideas about what to add, but I would like to hear from you as well. Thanks. [1] http://amitsaha.github.com/site/notes/_sources/articles/idle/article.txt -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17583 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17583] IDLE HOWTO
Amit Saha added the comment: Adding the patch here. I am not sure about how to add the screenshots, so I haven't done them. Just attached the document as a patch (note that I have placed in doc/howto). Thanks for the comments. -- hgrepos: +180 keywords: +patch Added file: http://bugs.python.org/file29641/idle.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17583 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17583] IDLE HOWTO
Amit Saha added the comment: Hi Ezio, thanks for your review comments. I will make the changes to the document, and also add the images in a later patch. I do agree that repeating package names for Python 2 and Python 3 is perhaps not an ideal way. I am also trying to think of other ways to justify having two separate documents: may be the code samples? print 'Hello world' versus print('Hello World') ? Thanks. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17583 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17583] IDLE HOWTO
Amit Saha added the comment: Hi Todd, thanks for your comments. I wanted to clarify that I intend to make this a HOWTO, not a FAQ. I hope that's fine? -Amit. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17583 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17583] IDLE HOWTO
New submission from Amit Saha: I would like to propose a new HOWTO discussing IDLE from a user's perspective. I feel that the current documentation at http://docs.python.org/3/library/idle.html is not sufficient to be pointed to a newbie programmer or someone who wants to teach his/her students to IDLE. For example, being an experienced person myself, I didn't know how to start IDLE on Linux! Whether it was a separate package, or whether it was already installed (That may be my own shortcoming, but never the less). I started a document this morning which can be seen here [1]. The source is here[2] [1] http://amitsaha.github.com/site/notes/articles/idle/article.html [2] http://amitsaha.github.com/site/notes/_sources/articles/idle/article.txt I am putting up my hand to write the HOWTO and maintain it for 2.7 and 3.3+. Comments? -- components: IDLE messages: 185600 nosy: Amit.Saha priority: normal severity: normal status: open title: IDLE HOWTO type: enhancement versions: Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17583 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Re: [Python-Dev] [RELEASED] Python 3.3.0
On Sat, Sep 29, 2012 at 10:18 PM, Georg Brandl ge...@python.org wrote: On behalf of the Python development team, I'm delighted to announce the Python 3.3.0 final release. Python 3.3 includes a range of improvements of the 3.x series, as well as easier porting between 2.x and 3.x. Major new features and changes in the 3.3 release series are: * PEP 380, syntax for delegating to a subgenerator (yield from) * PEP 393, flexible string representation (doing away with the distinction between wide and narrow Unicode builds) * A C implementation of the decimal module, with up to 120x speedup for decimal-heavy applications * The import system (__import__) now based on importlib by default * The new lzma module with LZMA/XZ support * PEP 397, a Python launcher for Windows * PEP 405, virtual environment support in core * PEP 420, namespace package support * PEP 3151, reworking the OS and IO exception hierarchy * PEP 3155, qualified name for classes and functions * PEP 409, suppressing exception context * PEP 414, explicit Unicode literals to help with porting * PEP 418, extended platform-independent clocks in the time module * PEP 412, a new key-sharing dictionary implementation that significantly saves memory for object-oriented code * PEP 362, the function-signature object * The new faulthandler module that helps diagnosing crashes * The new unittest.mock module * The new ipaddress module * The sys.implementation attribute * A policy framework for the email package, with a provisional (see PEP 411) policy that adds much improved unicode support for email header parsing * A collections.ChainMap class for linking mappings to a single unit * Wrappers for many more POSIX functions in the os and signal modules, as well as other useful functions such as sendfile() * Hash randomization, introduced in earlier bugfix releases, is now switched on by default In total, almost 500 API items are new or improved in Python 3.3. For a more extensive list of changes in 3.3.0, see http://docs.python.org/3.3/whatsnew/3.3.html Redirects to http://docs.python.org/py3k/whatsnew/3.3.html: 404 Not Found. Cheers, Amit. -- http://echorand.me -- http://mail.python.org/mailman/listinfo/python-list
Re: [Python-Dev] [RELEASED] Python 3.3.0
On Sat, Sep 29, 2012 at 10:37 PM, Dave Angel d...@davea.name wrote: On 09/29/2012 08:23 AM, Amit Saha wrote: On Sat, Sep 29, 2012 at 10:18 PM, Georg Brandl ge...@python.org wrote: snip For a more extensive list of changes in 3.3.0, see http://docs.python.org/3.3/whatsnew/3.3.html Redirects to http://docs.python.org/py3k/whatsnew/3.3.html: 404 Not Found. Works for me. Perhaps a momentary glitch. Yes, I clicked too soon, i guess.. -Amit. -- http://echorand.me -- http://mail.python.org/mailman/listinfo/python-list