Re: How to waste computer memory?

2016-03-19 Thread Steven D'Aprano
On Sun, 20 Mar 2016 03:12 am, Marko Rauhamaa wrote: > Steven D'Aprano : > >> On Sun, 20 Mar 2016 02:02 am, Marko Rauhamaa wrote: >>> Yes, but UTF-16 produces 16-bit values that are outside Unicode. >> >> Show me. >> >> Before you answer, if your answer is "surrogate pairs",

[issue26576] Tweak wording of decorator docos

2016-03-19 Thread Terry J. Reedy
Terry J. Reedy added the comment: Guido, the discrepancy between the decorator doc's 'equivalent code' and actual, optimized, behavior with regard to skipping an intermediate binding of the function to the name came up soon after decorators were added. I cannot find the issue, but as I

Re: How to waste computer memory?

2016-03-19 Thread sohcahtoa82
On Thursday, March 17, 2016 at 7:34:46 AM UTC-7, wxjm...@gmail.com wrote: > Very simple. Use Python and its (buggy) character encoding > model. > > How to save memory? > It's also very simple. Use a programming language, which > handles Unicode correctly. *looks at the other messages in this

[issue18140] urlparse, urlsplit confused when password includes fragment (#), query (?)

2016-03-19 Thread Martin Panter
Changes by Martin Panter : -- title: urlparse.urlsplit confused to fragment when password include # -> urlparse, urlsplit confused when password includes fragment (#), query (?) versions: +Python 3.5, Python 3.6 ___ Python

Re: Case Statements

2016-03-19 Thread Steven D'Aprano
On Thursday 17 March 2016 16:45, Gregory Ewing wrote: > Steven D'Aprano wrote: >> On Thu, 17 Mar 2016 11:31 am, Chris Angelico wrote: >> >>>orig = globals()[cls.__name__] >> >> I wouldn't want to rely on it working with decorator syntax either. Even >> if it does now, I'm not sure that's a

[issue26575] lambda not closed on specific value in comprehension

2016-03-19 Thread Martin Panter
Martin Panter added the comment: https://docs.python.org/3.5/faq/programming.html#why-do-lambdas-defined-in-a-loop-with-different-values-all-return-the-same-result -- nosy: +martin.panter resolution: -> not a bug status: open -> closed ___ Python

[issue26569] pyclbr.readmodule() and pyclbr.readmodule_ex() don't support namespace packages

2016-03-19 Thread Eric Snow
Eric Snow added the comment: Yeah, I've opened issue26584 to keep the matters separate. We can address a more comprehensive cleanup there. -- resolution: -> fixed stage: commit review -> resolved status: open -> closed ___ Python tracker

[issue26250] no document for sqlite3.Cursor.connection

2016-03-19 Thread Roundup Robot
Roundup Robot added the comment: New changeset 52660878c833 by Ezio Melotti in branch '3.5': #26250: document the sqlite3.Cursor.connection attribute. Initial patches by Aviv Palivoda and Varpu Rantala. https://hg.python.org/cpython/rev/52660878c833 New changeset 6fed752fd88e by Ezio Melotti

Re: Bash-like pipes in Python

2016-03-19 Thread Sivan Greenberg
If I understand correctly, the binary right or overloading that's seen here can be applied to any other computational objects. I could also think of implementing it for input / output pipes overloading the __ror__ method with .communicate() method of the Popen object [0]. -Sivan [0]:

Re: sobering observation, python vs. perl

2016-03-19 Thread BartC
On 17/03/2016 18:53, Marko Rauhamaa wrote: BartC : sub replacewith{ $s = $_[0]; $t = $_[1]; $u = $_[2]; $s =~ s/$t/$u/; return $s; } Although once done, the original task now looks a proper language: print (replacewith("I have a dream","have","had"));

Re: Case Statements

2016-03-19 Thread Chris Angelico
On Thu, Mar 17, 2016 at 8:23 PM, Antoon Pardon wrote: > Op 17-03-16 om 03:02 schreef Chris Angelico: >> On Thu, Mar 17, 2016 at 12:54 PM, Steven D'Aprano >> wrote: >> >>> I wouldn't want to rely on it working with decorator syntax either. Even

[issue26396] Create json.JSONType

2016-03-19 Thread Brett Cannon
Brett Cannon added the comment: Here is a preliminary patch with docs. I didn't do any tests because I just don't know what kind of test we would want. Use isinstance() to make sure it covers the types we expect? And I'm not sure how to test the key type for mappings. -- keywords:

[issue26553] Write HTTP in uppercase

2016-03-19 Thread Aatish Neupane
Changes by Aatish Neupane : Added file: http://bugs.python.org/file42197/fix_2.7.patch ___ Python tracker ___

[issue26567] ResourceWarning: Use tracemalloc to display the traceback where an object was allocated when a ResourceWarning is emitted

2016-03-19 Thread Roundup Robot
Roundup Robot added the comment: New changeset 2428d794b0e1 by Victor Stinner in branch 'default': On ResourceWarning, log traceback where the object was allocated https://hg.python.org/cpython/rev/2428d794b0e1 -- nosy: +python-dev ___ Python tracker

[issue26257] Eliminate buffer_tests.py

2016-03-19 Thread Ezio Melotti
Changes by Ezio Melotti : -- nosy: +ezio.melotti, serhiy.storchaka ___ Python tracker ___

Re: monkey patching __code__

2016-03-19 Thread Ian Kelly
On Mar 18, 2016 8:33 AM, "Sven R. Kunze" wrote: > > On 18.03.2016 14:47, Ian Kelly wrote: >> >> Your patched version takes two extra arguments. Did you add the >> defaults for those to the function's __defaults__ attribute? > > > That's it! :-) Thanks a lot. > > Just to

Re: Case Statements

2016-03-19 Thread Steven D'Aprano
On Thu, 17 Mar 2016 12:15 am, l0r0m0a0...@gmail.com wrote: > What hath I wrought? Dr Ray Stantz: Fire and brimstone coming down from the skies! Rivers and seas boiling! Dr Egon Spengler: Forty years of darkness! Earthquakes, volcanoes... Winston Zeddemore: The dead rising from the grave! Dr

[issue22758] Regression in Python 3.2 cookie parsing

2016-03-19 Thread Berker Peksag
Berker Peksag added the comment: I will commit this to the 3.2 branch today. -- status: closed -> open ___ Python tracker ___

Re: submodules

2016-03-19 Thread Peter Otten
ast wrote: > Hello > > Since in python3 ttk is a submodule of tkinter, I was expecting this > to work: > > from tkinter import * > > root = Tk() > nb = ttk.Notebook(root) > > but it doesnt, ttk is not known. > > I have to explicitely import ttk with > > from tkinter import ttk > > why ?

Re: sobering observation, python vs. perl

2016-03-19 Thread Charles T. Smith
On Thu, 17 Mar 2016 10:52:30 -0500, Tim Chase wrote: >> Not saying this will make a great deal of difference, but these two > items jumped out at me. I'd even be tempted to just use string > manipulations for the isready aspect as well. Something like > (untested) well, I don't want to forgo

Re: Bash-like pipes in Python

2016-03-19 Thread Marko Rauhamaa
Sivan Greenberg : > If I understand correctly, the binary right or overloading that's seen > here can be applied to any other computational objects. > > I could also think of implementing it for input / output pipes > overloading the __ror__ method with .communicate() method of

[issue26583] test_timestamp_overflow of test_importlib fails if PYTHONDONTWRITEBYTECODE is set

2016-03-19 Thread Ned Deily
Ned Deily added the comment: Ah, setting PYTHONDONTWRITEBYTECODE explains it. When running the tests via "make test", python is invoked with -E to avoid issues like that. But here's a patch that skips test_timestamp_overflow if bytecode files cannot be written (Issue20796 documents a

Re: sobering observation, python vs. perl

2016-03-19 Thread Marko Rauhamaa
"Charles T. Smith" : > well, I don't want to forgo REs in order to have python's numbers be > better http://stackoverflow.com/questions/12793562/text-processing-pytho n-vs-perl-performance> Marko -- https://mail.python.org/mailman/listinfo/python-list

[issue26040] Improve coverage and rigour of test.test_math

2016-03-19 Thread Jeff Allen
Changes by Jeff Allen : Added file: http://bugs.python.org/file42191/extra_cmath_testcases.py ___ Python tracker ___

Re: How to waste computer memory?

2016-03-19 Thread Random832
On Fri, Mar 18, 2016, at 11:17, Ian Kelly wrote: > > Just to play devil's advocate, here, why is it so bad for indexing to be > > O(n)? Some simple caching is all that's needed to prevent it from making > > iteration O(n^2), if that's what you're worried about. > > What kind of caching do you

Re: empty clause of for loops

2016-03-19 Thread Chris Angelico
On Sat, Mar 19, 2016 at 7:49 AM, Sven R. Kunze wrote: > On 18.03.2016 20:10, Palpandi wrote: >> >> You can do like this. >> >> if not my_iterable: >> >> for x in my_iterable: >> > > > Thanks for you help here, however as already pointed out, my_iterable is not >

Re: empty clause of for loops

2016-03-19 Thread Peter Otten
alister wrote: > On Wed, 16 Mar 2016 11:47:31 +0100, Peter Otten wrote: >> I'm kidding, of course. Keep it simple and use a flag like you would in >> any other language: >> >> empty = True: >> for item in items: >> empty = False ... >> if empty: >> ... > > or even use the loop

Re: WP-A: A New URL Shortener

2016-03-19 Thread Daniel Wilcox
I dare say I'm with Rick on this point -- keep it up, go learn stuff, put things together and see how they break -- I think it's the best way to get feel for how things fit together and, somewhat inevitably, fall over (when the conditions they were designed in no longer apply). *quick glance at

[issue26581] Double coding cookie

2016-03-19 Thread Serhiy Storchaka
New submission from Serhiy Storchaka: When Python source file contains double coding cookies on different lines, the first wins. When it contains double coding cookies on the same line, the last wins. PEP 263 was sufficiently vague about this. Now this is clarified (22490711c870). The first

Re: How to waste computer memory?

2016-03-19 Thread Chris Angelico
On Fri, Mar 18, 2016 at 8:08 AM, Grant Edwards wrote: > On 2016-03-17, Chris Angelico wrote: >> On Fri, Mar 18, 2016 at 7:31 AM, wrote: >>> Rick Johnson wrote: In the event that i change my mind

[issue26572] urlparse does not handle passwords with ? in them.

2016-03-19 Thread Martin Panter
Martin Panter added the comment: I think this is the same as Issue 18140. Perhaps you can answer my question at the bottom there about why the question mark is not encoded, and why splitting at the at (@) symbol should be higher priority than the query (?) symbol. -- nosy:

Any sqledit/sqlkit users here?

2016-03-19 Thread cl
Does anyone here use sqledit/sqlkit? It's a sqlite database browser/editor which does most of its work by introspection (at least I think that's the right name for it). Thus it's trivially simple to write a gui program to edit data in a database:- #!/usr/bin/python from sqlkit.widgets

Re: empty clause of for loops

2016-03-19 Thread Random832
On Wed, Mar 16, 2016, at 13:01, Sven R. Kunze wrote: > On 16.03.2016 17:56, Sven R. Kunze wrote: > > On 16.03.2016 17:37, Random832 wrote: > >> for item in collection: > >> if good(item): > >>thing = item > >>break > >> else: > >> thing = default # or raise an exception,

Re: How to waste computer memory?

2016-03-19 Thread Steven D'Aprano
On Sat, 19 Mar 2016 02:31 am, Random832 wrote: > On Fri, Mar 18, 2016, at 11:17, Ian Kelly wrote: >> > Just to play devil's advocate, here, why is it so bad for indexing to >> > be O(n)? Some simple caching is all that's needed to prevent it from >> > making iteration O(n^2), if that's what

Re: WP-A: A New URL Shortener

2016-03-19 Thread Thomas 'PointedEars' Lahn
Daniel Wilcox wrote: > Cool thanks, highly recommended to use an ORM to deter easy SQL > injections. That is to crack a nut with a sledgehammer. SQL injection can be easily and more efficiently prevented with prepared statements. While an Object- Relational Mapper (ORM) can use those, and

[issue26588] _tracemalloc: add support for multiple address spaces (domains)

2016-03-19 Thread STINNER Victor
STINNER Victor added the comment: Patch version 2: - modify _tracemalloc._get_traces() to include domain in traces - add tracemalloc.DomainFilter(domain) - add domain optional parameter to tracemalloc.Filter constructor Currently, Snapshot._group_by() ignores domain information. I don't know

[issue26252] Add an example to importlib docs on setting up an importer

2016-03-19 Thread Roundup Robot
Roundup Robot added the comment: New changeset dc24ab548e2b by Brett Cannon in branch 'default': Issue #26252: Add an example on how to register a finder https://hg.python.org/cpython/rev/dc24ab548e2b -- nosy: +python-dev ___ Python tracker

[issue25720] Fix curses module compilation with ncurses6

2016-03-19 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I suspect that the patch can break build with non-ncurses implementations or with old ncurses (when is_pad() was added?). Needed more direct feature check. -- ___ Python tracker

Re: Descriptors vs Property

2016-03-19 Thread Ethan Furman
On 03/11/2016 09:59 PM, Veek. M wrote: A property uses the @property decorator and has @foo.setter @foo.deleter. A descriptor follows the descriptor protocol and implements the __get__ __set__ __delete__ methods. `property` is a descriptor combined with a decorator, so is a little more

Re: Case Statements

2016-03-19 Thread l0r0m0a0i0l
What hath I wrought? -- https://mail.python.org/mailman/listinfo/python-list

Re: How to waste computer memory?

2016-03-19 Thread Terry Reedy
On 3/18/2016 7:58 AM, Steven D'Aprano wrote: On Fri, 18 Mar 2016 10:46 pm, Steven D'Aprano wrote: I think it is typical of JMF that his idea of a language where Unicode "just works" is one where it *does work at all* (at least not as strings). Er, does NOT work at all. Python 1.5 strings

RE: pdf version of python tutorial

2016-03-19 Thread Joaquin Alzola
Den 13-03-2016 kl. 14:45 skrev kamaraju kusumanchi: > Is there a pdf version of the python tutorial > https://docs.python.org/3/tutorial/index.html that I can download? The > idea is to have everything in one file so I can search easily, be able > to work offline. > > thanks > raju > >Try here:

Re: empty clause of for loops

2016-03-19 Thread Sven R. Kunze
On 16.03.2016 16:02, Tim Chase wrote: On 2016-03-16 15:29, Sven R. Kunze wrote: I would re-use the "for-else" for this. Everything I thought I could make use of the "-else" clause, I was disappointed I couldn't. Hmm...this must be a mind-set thing. I use the "else" clause with for/while loops

Re: Bash-like pipes in Python

2016-03-19 Thread Omar Abou Mrad
On Wed, Mar 16, 2016 at 4:57 PM, Steven D'Aprano wrote: > There's a powerful technique used in shell-scripting languages like bash: > pipes. The output of one function is piped in to become the input to the > next function. > > According to Martin Fowler, this was also used

[issue26530] tracemalloc: add C API to manually track/untrack memory allocations

2016-03-19 Thread STINNER Victor
STINNER Victor added the comment: > So you guarantee tracemalloc itself won't use such a hack for other purposes? ;-) Hum, maybe we can make the "hack" "official": add two C macro to store and retrieve the domain from a pointer. The macro can validate that the domain is smaller or equal to 8

Re: Experimenting with PyPyJS

2016-03-19 Thread Salvatore DI DIO
Le samedi 19 mars 2016 19:52:45 UTC+1, Terry Reedy a écrit : > On 3/19/2016 1:06 PM, Salvatore DI DIO wrote: > > Le samedi 19 mars 2016 18:00:05 UTC+1, Vincent Vande Vyvre a écrit : > >> Le 19/03/2016 16:32, Salvatore DI DIO a écrit : > >>> Le samedi 19 mars 2016 16:28:36 UTC+1, Salvatore DI DIO a

Re: Need help on a project To :"Create a class called BankAccount with the following parameters "

2016-03-19 Thread Ben Finney
anyanwuchukwueme...@gmail.com writes: > What was the final answer for the create class bankaccount question? The final answer is: homework entails that you do the work, not us. -- \ “I tell you the truth: some standing here will not taste death | `\before they see the Son of Man

[issue26583] test_timestamp_overflow fails

2016-03-19 Thread SilentGhost
Changes by SilentGhost : -- components: +Macintosh, Tests nosy: +ned.deily, ronaldoussoren type: -> behavior ___ Python tracker ___

[issue26543] imaplib noop Debug

2016-03-19 Thread gigaplastik
Changes by gigaplastik : -- nosy: +gigaplastik ___ Python tracker ___ ___

Re: Case Statements

2016-03-19 Thread BartC
On 16/03/2016 12:21, Marko Rauhamaa wrote: BartC : That's the first time I've heard a language feature common in C described as sexy. Scheme has a "switch" statement (a "case" form). However, it is slightly better equipped for it than Python: * Scheme has an atom type

[issue26040] Improve coverage and rigour of test.test_math

2016-03-19 Thread Jeff Allen
Changes by Jeff Allen : Removed file: http://bugs.python.org/file42190/stat_math.py ___ Python tracker ___

Re: Bash-like pipes in Python

2016-03-19 Thread Stefan Otte
I use the pipe style a lot, but one of the annoyances is that many functions in the python standardlib expect the first argument to be a callable and the second an iterable. I tend to write a lot of "p-functions" (functions which switch that order and make them compatible to `pipe`). from pelper

Re: DSLs in perl and python (Was sobering observation)

2016-03-19 Thread Peter Otten
Rustom Mody wrote: > On Friday, March 18, 2016 at 4:17:06 AM UTC+5:30, MRAB wrote: >> Stick an "x" on the end of the regex: /something/x or s/old/new/x. > > Thanks! > > Is there somewhere a regexp 'introspection' API/capability available? > > ie if the re looks like > rexp = r""" > # DSL

Re: monkey patching __code__

2016-03-19 Thread Matt Wheeler
On 18 March 2016 at 11:49, Sven R. Kunze wrote: > Hi, > > we got an interesting problem. We need to monkeypatch Django's reverse > function: > > > First approach: > > urlresolvers.reverse = patched_reverse > > > Problem: some of Django's internal modules import

[issue26574] replace_interleave can be optimized for single character byte strings

2016-03-19 Thread Josh Snider
New submission from Josh Snider: replace_interleave in Objects/bytesobject.c and Objects/bytearrayobject.c can be optimized for the special case where the interleaving byte string is a single character. Here's some quick results from timeit showing that it's about three times faster for the

Re: empty clause of for loops

2016-03-19 Thread Sven R. Kunze
On 16.03.2016 18:08, Random832 wrote: Yeah, well, you can *almost* get there with: try: thing = next(item for item in collection if good(item)) except StopIteration: thing = default But the for/else thing seems like a more natural way to do it. Plus, this is a toy example, if the

Re: Beginner Python Help

2016-03-19 Thread Martin A. Brown
Greetings Alan and welcome to Python, >I just started out python and I was doing a activity where im >trying to find the max and min of a list of numbers i inputted. > >This is my code.. > >num=input("Enter list of numbers") >list1=(num.split()) > >maxim= (max(list1)) >minim= (min(list1)) >

Re: WP-A: A New URL Shortener

2016-03-19 Thread Chris Warrick
On 15 March 2016 at 20:56, Vinicius Mesel wrote: > Hey guys, > > I'm a 16 year old Python Programmer that wanted to do something different. > But, like we know, ideas are quite difficult to find. > So I decided to develop a URL Shortener to help the Python community out and >

Re: monkey patching __code__

2016-03-19 Thread Ian Kelly
On Fri, Mar 18, 2016 at 9:01 AM, Sven R. Kunze wrote: > On 18.03.2016 15:48, Ian Kelly wrote: >> >> Well I didn't design it, so I'm not really sure. But it could be argued >> that the defaults are intrinsic to the function declaration, not the code >> object, as not all code

[issue26257] Eliminate buffer_tests.py

2016-03-19 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: It looks to me that all tests from CommonTest except test_capitalize_nonascii can be merged into BaseTest. A number of tests from MixinStrUnicodeUserStringTest could be applied to bytes and bytearray too. I think we should left only two classes in

Re: monkey patching __code__

2016-03-19 Thread Sven R. Kunze
On 18.03.2016 14:47, Ian Kelly wrote: Your patched version takes two extra arguments. Did you add the defaults for those to the function's __defaults__ attribute? That's it! :-) Thanks a lot. Just to understand this better: why is that not part of the code object but part of the function?

Re: empty clause of for loops

2016-03-19 Thread Tim Chase
On 2016-03-16 11:23, Sven R. Kunze wrote: > for x in my_iterable: > # do > empty: > # do something else > > What's the most Pythonic way of doing this? If you can len() on it, then the obvious way is if my_iterable: for x in my_iterable: do_something(x) else:

Re: Beautifulsoap

2016-03-19 Thread Joel Goldstick
On Wed, Mar 16, 2016 at 9:36 AM, wrote: > Greetings NG > > please I need a little help. > > I have this bs object tag: > > > > I want extract 5.69 > > Some have pity of me :-) > > Thanks > > > Show the code you have, and what isn't working. Which verision of python and BS >

[issue26587] Possible duplicate entries in sys.path if .pth files are used with zip's

2016-03-19 Thread Mandeep Singh Grang
Mandeep Singh Grang added the comment: Here is a testcase to reproduce the issue: > cat test.py import site, sys site.addsitedir('/foo/bar') print (sys.path) This prints just a single instance of '/foo/bar': ['/local/mnt/workspace/python/tst', '/foo/bar', '/usr/local/lib/python36.zip',

Python directory

2016-03-19 Thread Xerma Palmares
Hello, I have just downloaded Python latest version on to PC running windows 10. Unfortunately, after the completion of the download the Python icon was not showing up on the Desktop and could not found the Python files on the Programs folder either. I uninstalled Python, I will try it again.

[issue26578] Bad BaseHTTPRequestHandler response when using HTTP/0.9

2016-03-19 Thread Xiang Zhang
Xiang Zhang added the comment: I think you are right. Simply run http.server.test() and then telnet to send "GET /", the client hangs. Or add a timeout to BaseHTTPRequestHandler, you can see the timeout error on server output. -- ___ Python tracker

Re: Case Statements

2016-03-19 Thread Marko Rauhamaa
l0r0m0a0...@gmail.com: > Gratified to see that with all this back-and-forth this thread still > has a sense of humor. Perhaps, we can all just agree to disagree? :) I might agree with you if you tell me what we disagree about. Marko -- https://mail.python.org/mailman/listinfo/python-list

Re: sobering observation, python vs. perl

2016-03-19 Thread Marko Rauhamaa
"Charles T. Smith" : > Here's the programs: > > #!/usr/bin/env python > # vim: tw=0 > import sys > import re > > isready = re.compile ("(.*) is ready") > relreq = re.compile (".*release_req") > for fn in sys.argv[1:]: # logfile name >

Re: empty clause of for loops

2016-03-19 Thread Sven R. Kunze
On 16.03.2016 11:47, Peter Otten wrote: What would you expect? A keyword filling the missing functionality? Some Python magic, I haven't seen before. ;-) class Empty(Exception): pass ... def check_empty(items): ... items = iter(items) ... try: ... yield next(items)

Re: sobering observation, python vs. perl

2016-03-19 Thread Charles T. Smith
On Thu, 17 Mar 2016 18:30:29 +0200, Marko Rauhamaa wrote: > "Charles T. Smith" : > >> I need the second check to also be a RE because it's not >> separate tokens. > > The string "in" check doesn't care about tokens. > > > Marko Ah, yes. Okay. --

[issue17603] AC_LIBOBJ replacement of fileblocks

2016-03-19 Thread Roundup Robot
Roundup Robot added the comment: New changeset acbeb33dc76a by Martin Panter in branch '2.7': Issue #17603: Check for st_blocks field without requiring fileblocks.o https://hg.python.org/cpython/rev/acbeb33dc76a New changeset 0774398c3433 by Martin Panter in branch '3.5': Issue #17603: Check

Is this an error in python-babel or am I missing something?

2016-03-19 Thread cl
I am getting the following error when running some code that uses python-sqlkit. This uses python-babel to handle dates for different locales. Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/sqlkit-0.9.6.1-py2.7.egg/sqlkit/widgets/table/columns.py",

Re: What is the common technique used to cross-reference in module's method?

2016-03-19 Thread Peter Otten
jf...@ms4.hinet.net wrote: > There are two modules (say model.py and piece.py) which has methods need > to refer to each other module's methods. I saw in a book using the way > below, by assigning one (the Model) object to an attribute of the other > (the Piece) bject. - > ##model.py

retrieve key of only element in a dictionary (Python 3)

2016-03-19 Thread Fillmore
I must be missing something simple, but... Python 3.4.0 (default, Apr 11 2014, 13:05:11) [GCC 4.8.2] on linux Type "help", "copyright", "credits" or "license" for more information. >>> d = dict() >>> d['squib'] = "007" >>> # I forget that 'squib' is my key to retrieve the only element in d ...

Re: from a module return a class

2016-03-19 Thread Laurent Pointal
John Gordon wrote: > In > kevind0...@gmail.com writes: > >> ## prompt the user for a User name a& pWord >> user_pword = promptUser_PWord() > >> I get the error >> File

Re: from a module return a class

2016-03-19 Thread kevind0718
On Thursday, March 17, 2016 at 1:21:16 PM UTC-4, John Gordon wrote: > In > kevind0...@gmail.com writes: > > > ## prompt the user for a User name a& pWord > > user_pword = promptUser_PWord() > > > I get the error > > File

Re: retrieve key of only element in a dictionary (Python 3)

2016-03-19 Thread Tim Chase
On 2016-03-18 17:33, Fillmore wrote: > >>> d = dict() > >>> d['squib'] = "007" > >>> key = d.items()[0] I posted a similar question about 1-element-sets[1] a while back and Peter Otten & Rene Pijlman both suggested >>> s = set(["hello"]) >>> element, = s which, in your case would translate

[issue26576] Tweak wording of decorator docos

2016-03-19 Thread Georg Brandl
Georg Brandl added the comment: (Also, toggled your "is committer" bit so you get the Python logo next to your name.) -- ___ Python tracker ___

Re: Replace weird error message?

2016-03-19 Thread Chris Angelico
On Thu, Mar 17, 2016 at 5:39 AM, Joel Goldstick wrote: > can you show the complete code? It doesn't start with "{:02} I don't think Actually, yes it does; I can confirm the OP's concern: $ python3 Python 3.6.0a0 (default:ae76a1046bb9, Mar 17 2016, 05:45:31) [GCC 5.3.1

Re: sobering observation, python vs. perl

2016-03-19 Thread Marko Rauhamaa
BartC : > On 17/03/2016 18:53, Marko Rauhamaa wrote: >> BartC : > >>> sub replacewith{ >>> $s = $_[0]; >>> $t = $_[1]; >>> $u = $_[2]; >>> $s =~ s/$t/$u/; >>> return $s; >>> } >>> >>> Although once done, the original task now looks a proper

Re: empty clause of for loops

2016-03-19 Thread Sven R. Kunze
On 18.03.2016 20:10, Palpandi wrote: You can do like this. if not my_iterable: for x in my_iterable: Thanks for you help here, however as already pointed out, my_iterable is not necessarily a list but more likely an exhaustible iterator/generator. Best, Sven --

[issue26470] Make OpenSSL module compatible with OpenSSL 1.1.0

2016-03-19 Thread Christian Heimes
Christian Heimes added the comment: Here is a first working patch. It requires 1.1.0-pre4. The failing ALPN test is caused by a regression in OpenSSL. -- keywords: +patch stage: needs patch -> patch review versions: +Python 3.6 Added file:

Re: Need help on a project To :"Create a class called BankAccount with the following parameters "

2016-03-19 Thread Mark Lawrence
On 19/03/2016 21:40, anyanwuchukwueme...@gmail.com wrote: What was the final answer for the create class bankaccount question? 42. -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence --

Re: empty clause of for loops

2016-03-19 Thread Peter Otten
André Roberge wrote: > On Wednesday, 16 March 2016 07:23:48 UTC-3, Sven R. Kunze wrote: >> Hi, >> >> a colleague of mine (I write this mail because I am on the list) has the >> following issue: >> >> >> for x in my_iterable: >> # do >> empty: >> # do something else >> >> >> What's

[issue26567] ResourceWarning: Use tracemalloc to display the traceback where an object was allocated when a ResourceWarning is emitted

2016-03-19 Thread STINNER Victor
STINNER Victor added the comment: It looks like io.FileIO has a strong implementation of the destructor. If the object becomes alive again because of random code called in the destructor, the object is not removed. socket and os.scandir have a classical unsafe destructor. Moreover, I'm no

Re: Need help on a project To :"Create a class called BankAccount with the following parameters "

2016-03-19 Thread Joel Goldstick
On Sat, Mar 19, 2016 at 5:40 PM, wrote: > What was the final answer for the create class bankaccount question? > -- > https://mail.python.org/mailman/listinfo/python-list > Was it 14? -- Joel Goldstick http://joelgoldstick.com/

Re: Need help on a project To :"Create a class called BankAccount with the following parameters "

2016-03-19 Thread anyanwuchukwuemeka9
What was the final answer for the create class bankaccount question? -- https://mail.python.org/mailman/listinfo/python-list

Re: WP-A: A New URL Shortener

2016-03-19 Thread Mark Lawrence
On 17/03/2016 22:34, Daniel Wilcox wrote: +list You will be far more welcome here if you intersperse your replies or bottom post. Top posting is very heavily frowned upon. Thanks. -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language.

[issue26577] inspect.getclosurevars returns incorrect variable when using class member with the same name as other variable

2016-03-19 Thread Ryan Fox
New submission from Ryan Fox: If a variable 'x' exists in the global or local scope, and a function (also defined in the same scope as 'x', or lower) refers only to a member named 'x' of an object, inspect.getclosurevars will include a reference to the variable, rather than the member. Okay,

[issue26553] Write HTTP in uppercase

2016-03-19 Thread Aatish Neupane
Changes by Aatish Neupane : Added file: http://bugs.python.org/file42198/fix_3.5.patch ___ Python tracker ___

[issue26519] Cython doesn't work anymore on Python 3.6

2016-03-19 Thread Stefan Behnel
Stefan Behnel added the comment: Our CI build server says it's all fine. The fix will eventually be released, certainly before Py3.6 comes out. -- ___ Python tracker

Re: Bash-like pipes in Python

2016-03-19 Thread Chris Angelico
On Thu, Mar 17, 2016 at 4:04 AM, Marko Rauhamaa wrote: > Question: Could the generators define __repr__ so you wouldn't need to > terminate the pipeline with "List" in interactive use? No no no no. You do NOT want __repr__ to fundamentally change the state of the object (which

Re: AIX build and (potentially missing modules

2016-03-19 Thread Terry Reedy
On 3/17/2016 7:02 PM, Michael Felt wrote: I have been packaging python for AIX - and wanting minimal dependancies I have been ignoring the final messages from make. You must be packaging 2.x rathar than 3.x Personally, I do not see any real harm in the missing *audio "bits", but how terrible

Re: How to waste computer memory?

2016-03-19 Thread Mark Lawrence
On 17/03/2016 21:13, Chris Angelico wrote: You can pretend that only 1 and 0 are enough. Good luck making THAT work. ChrisA The sales and marketing "thing", for lack of a better expression, that was used in the UK by Racal Telecommunications during the 1990s. Well I'm telling a fib, IIRC

[issue26567] ResourceWarning: Use tracemalloc to display the traceback where an object was allocated when a ResourceWarning is emitted

2016-03-19 Thread STINNER Victor
STINNER Victor added the comment: I used this patch to identify a ResourceWarning in test_faulthandler when the test is interrupted by CTRL+c: it's really efficient! I will be very useful to identify all ResourceWarning that I saw in test_asyncio, like the ones seen on the AIX buildbot.

Re: Case Statements

2016-03-19 Thread Steven D'Aprano
On Wed, 16 Mar 2016 09:34 pm, BartC wrote: > (BTW why does Python have 'elif' when if-else is all that is really > needed?) To save indentation. if condition: block else: if other: block else: if third: block else: block versus:

Re: How to waste computer memory?

2016-03-19 Thread Mark Lawrence
On 18/03/2016 21:02, Marko Rauhamaa wrote: Chris Angelico : On Sat, Mar 19, 2016 at 2:26 AM, Marko Rauhamaa wrote: It may be that Python's Unicode abstraction is an untenable illusion because the underlying reality is 8-bit and there's no way to hide it

[issue26567] ResourceWarning: Use tracemalloc to display the traceback where an object was allocated when a ResourceWarning is emitted

2016-03-19 Thread STINNER Victor
STINNER Victor added the comment: When warnings._showwarnmsg(), the io.FileIO object is not closed yet, so all attributes are accessible, which can be useful. Hopefully, the file is closed even if it is kept alive by the warning logger. So maybe it's ok to keep the Python object alive, if the

file -SAS

2016-03-19 Thread Val Krem via Python-list
Hi all, I am trying to read sas7bdat file using the following from sas7bdat import SAS7BDAT with SAS7BDAT('test.sas7bdat') as f: for row in f: print row ### I want print the first 10 row. how can I do that? I got error message of from sas7bdat import SAS7BDAT ImportError: No

Re: Simple exercise

2016-03-19 Thread boffi
Rodrick Brown writes: > BANANA FRIES 12 > POTATO CHIPS 30 > APPLE JUICE 10 > CANDY 5 > APPLE JUICE 10 > CANDY 5 > CANDY 5 > CANDY 5 > POTATO CHIPS 30 > > I'm expecting the following output > BANANA FRIES 12 > POTATO CHIPS 60 > APPLE JUICE 20 > CANDY 20 >>> data

  1   2   3   4   5   >