Re: Replace weird error message?

2016-03-19 Thread Joel Goldstick
On Wed, Mar 16, 2016 at 2:53 PM, Ben Finney wrote: > "the.gerenuk--- via Python-list" writes: > > > The following error message, makes it a bit hard to understand what went > wrong > > > > >>> "{:02}".format("1") > > Traceback (most recent call last): > > File "", line 1, in > > ValueError: '

Re: Bash-like pipes in Python

2016-03-19 Thread Omar Abou Mrad
On Wed, Mar 16, 2016 at 5:39 PM, Steven D'Aprano wrote: > On Thu, 17 Mar 2016 02:22 am, Omar Abou Mrad wrote: > > > Would be nice if this was possible: > > > get_digits = Filter(str.isdigit) | Map(int) > 'kjkjsdf399834' | get_digits > > > Yes it would. I'll work on that. > > > > Also, h

Re: WP-A: A New URL Shortener

2016-03-19 Thread Rick Johnson
On Thursday, March 17, 2016 at 4:15:37 PM UTC-5, Thomas 'PointedEars' Lahn wrote: > Get a life, *please*. Well, you see *Thomas*, the problem is, this *IS* my life! I couldn't remove myself from this life anymore than you could apply a Bézier curve to your upper auricles -- we just wouldn't b

Re: empty clause of for loops

2016-03-19 Thread Sven R. Kunze
On 16.03.2016 17:20, Terry Reedy wrote: On 3/16/2016 11:17 AM, Sven R. Kunze wrote: On 16.03.2016 16:02, Tim Chase wrote: Does it annoy me when I have to work in other languages that lack Python's {for/while}/else functionality? You bet. I can imagine that. Could you describe the general

Re: MIT Python Tool - beta testers

2016-03-19 Thread Chris Patti
Hi Ashton, I'd love to give it a try. I'm on OSX Yosemite. Thanks! -Chris Sent from my iPad > On Mar 15, 2016, at 7:23 PM, Ashton Braun wrote: > > Kite is an MIT startup developing a new type of programming tool / > programming assistant. > > We are looking for python programmers who write co

Re: from a module return a class

2016-03-19 Thread John Gordon
In kevind0...@gmail.com writes: > ## prompt the user for a User name a& pWord > user_pword = promptUser_PWord() > I get the error > File "H:\dev\eclipse\workspace\genXls\src\genXls\promptUser_PWord.py", line > 58 > return user_pword > SyntaxError: 'return' outside function

Re: How to waste computer memory?

2016-03-19 Thread Tim Golden
On 18/03/2016 18:18, sohcahto...@gmail.com wrote: 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.

Re: from a module return a class

2016-03-19 Thread Wolfgang Maier
On 18.03.2016 16:08, John Gordon wrote: In kevind0...@gmail.com writes: As requested , full code for promptUser_PWord So promptUser_PWord is a module? Well, I'm confused. You gave us this bit of code: user_pword = promptUser_PWord() But that can't work if promptUser_PWord is a mo

Re: empty clause of for loops

2016-03-19 Thread alister
On Wed, 16 Mar 2016 11:47:31 +0100, Peter Otten wrote: > 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 the most

Re: creating multiple python Django projects in Windows environment

2016-03-19 Thread Reto Brunner
Hi Ivan, The idea is basically that you provide a web frontend on a server (internet or intranet) which provides just a web interface that enables eg the upload of an excel sheet. On the server the data gets processed (in this example makes the "clean" excel) and then allows the user to download

Re: Case Statements

2016-03-19 Thread Marko Rauhamaa
Antoon Pardon : > Look at decorators. They don't provide functionality we wouldn't have > without them. So we don't actually need them. Do you argue that > introducing them wasn't progress? I do. Marko -- https://mail.python.org/mailman/listinfo/python-list

Re: creating multiple python Django projects in Windows environment

2016-03-19 Thread Ivan Jankovic
Hi Reto. I understand that i need to run Django on a server. I have deployed projects to AWS (ubuntu) in the past. My main question is around how to tie it into the windows environment. Ivan On Mar 18, 2016 7:40 PM, Reto Brunner wrote: Well you can just put it on a proper server. In the end

Re: sobering observation, python vs. perl

2016-03-19 Thread Marko Rauhamaa
"Charles T. Smith" : > On Thu, 17 Mar 2016 15:29:47 +, Charles T. Smith wrote: > > And for completeness, and also surprising: > > time sed -n -e '/ is ready/{s///;h}' -e '/release_req/{g;p}' *.out | sort -u > TestCase_F_00_P > TestCase_F_00_S > TestCase_F_01_S > TestCase_F_02_M > > real0m

submodules

2016-03-19 Thread ast
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 ? -- https://mail.python.org/mailman/listinfo/pyth

Re: How to waste computer memory?

2016-03-19 Thread Steven D'Aprano
On Sat, 19 Mar 2016 02:26 am, Marko Rauhamaa wrote: > Michael Torrie : > >> On 03/18/2016 02:26 AM, Jussi Piitulainen wrote: >>> I think Julia's way of dealing with its strings-as-UTF-8 [2] is more >>> promising. Indexing is by bytes (1-based in Julia) but the value at a >>> valid index is the wh

Re: Beginner Python Help

2016-03-19 Thread Ben Finney
Alan Gabriel writes: > 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. Welcome to Python! As a Python beginner you will be interested to join the ‘python-tutor’ forum https://mail.python.org/mailman/listinfo/tutor>

Re: How to waste computer memory?

2016-03-19 Thread alister
On Thu, 17 Mar 2016 21:37:02 +, alister wrote: > On Fri, 18 Mar 2016 07:42:30 +1100, Chris Angelico wrote: > >> On Fri, Mar 18, 2016 at 7:31 AM, wrote: >>> Rick Johnson wrote: In the event that i change my mind about Unicode, and/or for the sake of others, who may want to kn

Re: empty clause of for loops

2016-03-19 Thread Steven D'Aprano
On Thu, 17 Mar 2016 05:05 am, Sven R. Kunze wrote: > What I don't understand is why Python features "if break, then no else > clause", but "if empty, then empty clause". > > I found this excellent post: > https://shahriar.svbtle.com/pythons-else-clause-in-loops That post describes the motivating

Bash-like pipes in Python

2016-03-19 Thread Steven D'Aprano
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 extensively in Smalltalk: http://martinfowler.com/articles/collection-pipeline/ and can

Re: Case Statements

2016-03-19 Thread Chris Angelico
On Thu, Mar 17, 2016 at 5:29 PM, Steven D'Aprano wrote: > I don't think that property is a similar situation. I think what happens > here is that the first call to property sets: > > # @property def x... > x = property(x) > > Then the second decorator does: > > # @x.setter def x... > x = x.setter(

Re: sobering observation, python vs. perl

2016-03-19 Thread Rustom Mody
On Thursday, March 17, 2016 at 11:24:00 PM UTC+5:30, BartC wrote: > On 17/03/2016 17:25, Charles T. Smith wrote: > > On Thu, 17 Mar 2016 19:08:58 +0200, Marko Rauhamaa wrote: > > >> my $str = "I have a dream"; > >> my $find = "have"; > >> my $replace = "had"; > >> $find = quotemeta

Re: How to waste computer memory?

2016-03-19 Thread Ian Kelly
On Fri, Mar 18, 2016 at 6:37 AM, Chris Angelico wrote: > On Fri, Mar 18, 2016 at 10:46 PM, Steven D'Aprano wrote: >> Technically, UTF-8 doesn't *necessarily* imply indexing is O(n). For >> instance, your UTF-8 string might consist of an array of bytes containing >> the string, plus an array of in

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

2016-03-19 Thread Larry Martell
On Fri, Mar 18, 2016 at 5:33 PM, Fillmore wrote: > > 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

Re: empty clause of for loops

2016-03-19 Thread Palpandi
On Wednesday, March 16, 2016 at 3:53:48 PM UTC+5:30, 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 the most Pythonic way of doi

Re: Replace weird error message?

2016-03-19 Thread Terry Reedy
On 3/16/2016 2:53 PM, Ben Finney wrote: "the.gerenuk--- via Python-list" writes: The following error message, makes it a bit hard to understand what went wrong "{:02}".format("1") Traceback (most recent call last): File "", line 1, in ValueError: '=' alignment not allowed in string form

Re: Case Statements

2016-03-19 Thread Marko Rauhamaa
BartC : > Yes, a few scripting languages can do interesting things with switch or > case statements. Perl for example (where I think it is created out other > language features, but it looks a regular part of the syntax). > > Even Ruby has one. It doesn't do anything 'sexy' with it, but it does >

Re: WP-A: A New URL Shortener

2016-03-19 Thread Daniel Wilcox
=D On Wed, Mar 16, 2016 at 11:16 AM, Rick Johnson wrote: > On Wednesday, March 16, 2016 at 7:02:16 AM UTC-5, Daniel Wilcox wrote: > > I dare say I'm with Rick on this point[...] > > Contrary to "pseudo popular belief", it's perfectly okay to > agree with Rick (from time to time). Hey, even a sto

Re: WP-A: A New URL Shortener

2016-03-19 Thread Dan Sommers
On Thu, 17 Mar 2016 23:08:24 +1100, Chris Angelico wrote: > So you would need to come up with a system that's distributed (such > that one computer's inaccessibility doesn't bring everything down) and > permanent (keep on circulating that information!). It could be a > rather fun problem to tackle

Re: How to waste computer memory?

2016-03-19 Thread Terry Reedy
On 3/18/2016 12:44 PM, Steven D'Aprano wrote: Hmmm, well, nobody uses UCS-2 any more, since that only covers the first 65536 code points. Unfortunately, tcl, or at least tk, still uses ucs-2. Hence tkinter and applications thereof, like IDLE, can only display BMP code points. A real nuisanc

Re: empty clause of for loops

2016-03-19 Thread Mark Lawrence
On 16/03/2016 13:25, alister wrote: On Wed, 16 Mar 2016 11:47:31 +0100, Peter Otten wrote: 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 the most

Replace weird error message?

2016-03-19 Thread the.gerenuk--- via Python-list
The following error message, makes it a bit hard to understand what went wrong >>> "{:02}".format("1") Traceback (most recent call last): File "", line 1, in ValueError: '=' alignment not allowed in string format specifier (this can happen easily if you read in text files and forget to convert

Re: How to waste computer memory?

2016-03-19 Thread Ian Kelly
On Thu, Mar 17, 2016 at 1:21 PM, Rick Johnson wrote: > In the event that i change my mind about Unicode, and/or for > the sake of others, who may want to know, please provide a > list of languages that *YOU* think handle Unicode better than > Python, starting with the best first. Thanks. jmf has

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

2016-03-19 Thread Rustom Mody
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 (instantiation) for describing NYSE symbology

Re: How to waste computer memory?

2016-03-19 Thread Chris Angelico
On Sat, Mar 19, 2016 at 2:26 AM, Marko Rauhamaa wrote: > Michael Torrie : > >> On 03/18/2016 02:26 AM, Jussi Piitulainen wrote: >>> I think Julia's way of dealing with its strings-as-UTF-8 [2] is more >>> promising. Indexing is by bytes (1-based in Julia) but the value at a >>> valid index is the

Re: sobering observation, python vs. perl

2016-03-19 Thread Anders J. Munch
Charles T. Smith: I've really learned to love working with python, but it's too soon to pack perl away. I was amazed at how long a simple file search took so I ran some statistics: Write Python in pythonic style instead of translated-from-Perl style, and the tables are turned: $ cat find-re

Re: sobering observation, python vs. perl

2016-03-19 Thread Ethan Furman
On 03/17/2016 09:36 AM, Charles T. Smith wrote: Yes, your point was to forgo REs despite that they are useful. I could have thought the search would have been better as: 'release[-.:][Rr]eq' or something else ... you're in a "defend python at all costs!" mode. No, I'm in the "don't try

Re: empty clause of for loops

2016-03-19 Thread Tim Chase
On 2016-03-16 16:53, Peter Otten wrote: > > item=None > > for item in items: > > #do stuff > if item is None: > > #do something else > > I like that better now I see it. The only problem with that is if your iterable returns None as the last item: items = ["Something here", N

Re: Replace weird error message?

2016-03-19 Thread Ben Finney
"the.gerenuk--- via Python-list" writes: > The following error message, makes it a bit hard to understand what went wrong > > >>> "{:02}".format("1") > Traceback (most recent call last): > File "", line 1, in > ValueError: '=' alignment not allowed in string format specifier Meaning that the

Re: How to waste computer memory?

2016-03-19 Thread Marko Rauhamaa
Random832 : > On Fri, Mar 18, 2016, at 20:55, Chris Angelico wrote: >> On Sat, Mar 19, 2016 at 9:03 AM, Marko Rauhamaa wrote: >> > Also, special-casing '\0' and '/' is >> > lame. Why can't I have "Results 1/2016" as a filename? >> >> Would you be allowed to have a directory named "Results 1" as

Re: How to waste computer memory?

2016-03-19 Thread Chris Angelico
On Sat, Mar 19, 2016 at 6:49 PM, Marko Rauhamaa wrote: > Speaking of the low level, the classic UNIX file system doesn't make use > of pathnames. Rather, the files are nameless. They are identified by the > device (= file system) number plus the inode number. Not entirely fair. A file system has

Re: from a module return a class

2016-03-19 Thread Rick Johnson
On Thursday, March 17, 2016 at 1:24:10 PM UTC-5, Laurent Pointal wrote: > So the error: SyntaxError: 'return' outside function >>> return SyntaxError: 'return' outside function -- https://mail.python.org/mailman/listinfo/python-list

Re: How to waste computer memory?

2016-03-19 Thread Steven D'Aprano
On Sat, 19 Mar 2016 08:08 am, Chris Angelico wrote: > On Sat, Mar 19, 2016 at 8:02 AM, 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 re

Re: sobering observation, python vs. perl

2016-03-19 Thread Charles T. Smith
On Thu, 17 Mar 2016 18:34:06 +0200, Marko Rauhamaa wrote: > n-vs-perl-performance Okay, that was interesting. Actually, I saw a study some years ago that concluded that python could be both slower and faster than perl, but that perl had much less deviation than python. I took that and accepted

Re: Case Statements

2016-03-19 Thread Chris Angelico
On Thu, Mar 17, 2016 at 4:45 PM, 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 tha

Re: How to waste computer memory?

2016-03-19 Thread Chris Angelico
On Sat, Mar 19, 2016 at 8:28 AM, Marko Rauhamaa wrote: > Chris Angelico : > >> The problem is not Python's Unicode strings, then. The problem is the >> notion that path names are text. If they're text, they should be >> exclusively text (although, for low-level efficiency, they're more >> likely t

Re: monkey patching __code__

2016-03-19 Thread Ned Batchelder
On Friday, March 18, 2016 at 10:33:46 AM UTC-4, Sven R. Kunze wrote: > On 18.03.2016 15:23, Ian Kelly wrote: > > On Fri, Mar 18, 2016 at 7:47 AM, Ian Kelly wrote: > >> Your patched version takes two extra arguments. Did you add the > >> defaults for those to the function's __defaults__ attribute?

Re: Case Statements

2016-03-19 Thread Chris Angelico
On Thu, Mar 17, 2016 at 12:54 PM, Steven D'Aprano wrote: > On Thu, 17 Mar 2016 11:31 am, Chris Angelico wrote: > >> Yes... in theory. But try rewriting my example to avoid decorator >> syntax. It won't work, because of this line: >> >> orig = globals()[cls.__name__] > > That's a nasty, dirty p

Re: Case Statements

2016-03-19 Thread Mark Lawrence
On 16/03/2016 13:15, l0r0m0a0...@gmail.com wrote: What hath I wrought? The Comfy Chair :) -- 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

Re: How to waste computer memory?

2016-03-19 Thread Chris Angelico
On Fri, Mar 18, 2016 at 8:11 AM, Marko Rauhamaa wrote: > Chris Angelico : > >> Like every language *including* English. You can pretend that ASCII is >> enough, but you do lose some information. > > Hold it, I'll quickly update my résumé before we resume the > conversation. What does this exposé e

Re: Case Statements

2016-03-19 Thread Steven D'Aprano
On Thu, 17 Mar 2016 05:48 pm, Chris Angelico wrote: > On Thu, Mar 17, 2016 at 5:29 PM, Steven D'Aprano > wrote: >> I don't think that property is a similar situation. I think what happens >> here is that the first call to property sets: >> >> # @property def x... >> x = property(x) >> >> Then the

Re: Exception from pyd methods

2016-03-19 Thread dieter
Palpandi writes: > I am using methods from pyd files. At some cases, it is throwing some error > messages in the console. > > When I use try.. except.. I am getting only the exception name. > Not able to catch the entire error message. > > How do I get the the entire error message printed in the

Re: How to waste computer memory?

2016-03-19 Thread Chris Angelico
On Sat, Mar 19, 2016 at 7:22 PM, Marko Rauhamaa wrote: > Not all files have pathnames. Those that do have numerous pathnames. You > can't tell by looking at a file what pathnames, if any, it might have. > You need an exhaustive, recursive search of the file system for the > reverse mapping. > > If

Re: Fetch Gmail Archieved messages

2016-03-19 Thread Rick Johnson
On Friday, March 18, 2016 at 9:19:34 AM UTC-5, Arshpreet Singh wrote: > On Friday, 18 March 2016 11:14:44 UTC+5:30, Rick Johnson wrote: > > > # > > # BEGIN CODE > > # > > import imaplib > > > > def inbox_week(): > > emailAddress = '...@gmail.com' > > emailPassword = 'mypassword' > >

Re: empty clause of for loops

2016-03-19 Thread Terry Reedy
On 3/16/2016 11:17 AM, Sven R. Kunze wrote: On 16.03.2016 16:02, Tim Chase wrote: Does it annoy me when I have to work in other languages that lack Python's {for/while}/else functionality? You bet. I can imagine that. Could you describe the general use-case? From what I know, "else" is exec

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

2016-03-19 Thread Steven D'Aprano
On Sat, 19 Mar 2016 12:36 pm, Chris Angelico wrote: > So unpacking will give you those keys - in an arbitrary order. Of > course, you don't care about the order when there's only one. But what if you want the key in reverse order? # Standard order [key] = mydict # Reverse order [yɘʞ] = mydict

Re: How to waste computer memory?

2016-03-19 Thread Steven D'Aprano
On Sat, 19 Mar 2016 01:30 pm, Random832 wrote: > On Fri, Mar 18, 2016, at 20:55, Chris Angelico wrote: >> On Sat, Mar 19, 2016 at 9:03 AM, Marko Rauhamaa wrote: >> > Also, special-casing '\0' and '/' is >> > lame. Why can't I have "Results 1/2016" as a filename? >> >> Would you be allowed to hav

Re: How to waste computer memory?

2016-03-19 Thread Rick Johnson
On Thursday, March 17, 2016 at 7:52:26 PM UTC-5, Gene Heskett wrote: > So the obvious question then is, will any of your python code still be > running and doing its labor saving and dead on the video frame timing > job several times daily, 17 years hence? Well, let me put it this way folks: As

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

2016-03-19 Thread Chris Angelico
On Sat, Mar 19, 2016 at 7:29 PM, Steven D'Aprano wrote: > On Sat, 19 Mar 2016 12:36 pm, Chris Angelico wrote: > >> So unpacking will give you those keys - in an arbitrary order. Of >> course, you don't care about the order when there's only one. > > But what if you want the key in reverse order? >

Re: How to waste computer memory?

2016-03-19 Thread Chris Angelico
On Sat, Mar 19, 2016 at 7:38 PM, Steven D'Aprano wrote: > ls -l /home/user/documents/stuff/foo > > > ls -l "home","user","documents","stuff","foo" > > > I think users of command line tools and shells will hate you. You misunderstand him. He doesn't want path names like that. He wants JSON, rememb

Re: sobering observation, python vs. perl

2016-03-19 Thread Charles T. Smith
On Thu, 17 Mar 2016 17:47:55 +0200, Marko Rauhamaa wrote: > Can't comment on the numbers but the code segments are not quite > analogous. What about this one: > > #!/usr/bin/env python > # vim: tw=0 > import sys > import re > > isready = re.compile("(.*) is ready") > for

Re: sobering observation, python vs. perl

2016-03-19 Thread Peter Otten
Charles T. Smith wrote: > 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

Re: Bash-like pipes in Python

2016-03-19 Thread Random832
On Thu, Mar 17, 2016, at 10:36, Chris Angelico wrote: > This object has a generator/list duality, but if you observe it, it > collapses to a list. When used interactively, it'd be pretty much the > same as calling list() as the last step, but in a script, they'd > operate lazily. > > Quantum com

Re: empty clause of for loops

2016-03-19 Thread Steven D'Aprano
On Wed, 16 Mar 2016 11:41 pm, André Roberge wrote: > for x in my_iterable: ># do something > > if not my_iterable: ># do something else Doesn't work for iterators. Iterators are (in general) always truthy, whether they are empty or not. -- Steven -- https://mail.python.org/mailman

Re: empty clause of for loops

2016-03-19 Thread André Roberge
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 the most Pythonic way of doing this?

Re: Case Statements

2016-03-19 Thread BartC
On 16/03/2016 09:51, Mark Lawrence wrote: On 16/03/2016 09:35, Antoon Pardon wrote: So I guess those who would like a case statement in Python can only hope a core developer gets bitten by a nasty bug while using one of those ways of simulating switches. So that core developers can waste th

Re: from a module return a class

2016-03-19 Thread Laurent Pointal
kevind0...@gmail.com wrote: > Hello: > > Working with python 2.7. > > I have a module promptUser_PWord that will prompt a user for their user > name and pword. Works fine stand alone. > I also have a module, genXLS that does a bunch of processing it has worked > fine for months. And a class U

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

2016-03-19 Thread Mark Lawrence
On 17/03/2016 17:47, Rustom Mody wrote: On Thursday, March 17, 2016 at 10:09:27 PM UTC+5:30, Charles T. Smith wrote: or something else ... you're in a "defend python at all costs!" mode. So now my questions: How do you in perl make regexps readable like python's VERBOSE? Can you do better in p

Re: How to waste computer memory?

2016-03-19 Thread Chris Angelico
On Fri, Mar 18, 2016 at 10:46 PM, Steven D'Aprano wrote: > On Fri, 18 Mar 2016 06:00 pm, Ian Kelly wrote: > >> On Thu, Mar 17, 2016 at 1:21 PM, Rick Johnson >> wrote: >>> In the event that i change my mind about Unicode, and/or for >>> the sake of others, who may want to know, please provide a >>

Re: Case Statements

2016-03-19 Thread Antoon Pardon
Op 16-03-16 om 20:27 schreef Marko Rauhamaa: > Antoon Pardon : > >> Look at decorators. They don't provide functionality we wouldn't have >> without them. So we don't actually need them. Do you argue that >> introducing them wasn't progress? > I do. Way to miss the point. Sure there will be people

Re: empty clause of for loops

2016-03-19 Thread Steven D'Aprano
On Wed, 16 Mar 2016 09:23 pm, 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 the most Pythonic way of doing this? Doing what?

Re: Replace weird error message?

2016-03-19 Thread Joel Goldstick
can you show the complete code? It doesn't start with "{:02} I don't think On Wed, Mar 16, 2016 at 2:34 PM, the.gerenuk--- via Python-list < python-list@python.org> wrote: > The following error message, makes it a bit hard to understand what went > wrong > > >>> "{:02}".format("1") > Traceback (

Re: How to waste computer memory?

2016-03-19 Thread Marko Rauhamaa
Steven D'Aprano : > One thing that NTFS gets right is that all path names are guaranteed > to be well-formed, valid Unicode. I believe that they are stored in > UTF-16, and unlike the ext file systems used on Linux, they are not > arbitrary bytes. https://msdn.microsoft.com/en-us/library/windows/

Re: empty clause of for loops

2016-03-19 Thread Sven R. Kunze
On 16.03.2016 14:09, Tim Chase wrote: If you can len() on it, then the obvious way is if my_iterable: for x in my_iterable: do_something(x) else: something_else() However, based on your follow-up that it's an exhaustible iterator rather than something you can len(), I'd u

TSP in python ; this is code to solve tsp whenever called, where given coordinates as in name of pos and then start coordinate as in start, help me how it works ?

2016-03-19 Thread Qurrat ul Ainy
from os import system, getcwd, chdir def tsp_generate_hops(pos, start, length): hops = [] tour = solve_tsp(pos) c = -1 for hop in tsp_hop_gen(tour, start): c += 1 hops.append(hop) if c == length: break return hops def solve_tsp(data): old_cwd = getcwd(

Re: How to waste computer memory?

2016-03-19 Thread Mark Lawrence
On 19/03/2016 04:05, Ian Kelly wrote: On Fri, Mar 18, 2016 at 3:19 PM, Mark Lawrence wrote: I have no idea at what the above can mean, other than that you are agreeing with the RUE. Mark, are you aware that this is a rather classic ad hominem of guilt by association? "I didn't pay any attent

Re: How to waste computer memory?

2016-03-19 Thread Marko Rauhamaa
Chris Angelico : > On Sat, Mar 19, 2016 at 7:22 PM, Marko Rauhamaa wrote: >> Not all files have pathnames. Those that do have numerous pathnames. You >> can't tell by looking at a file what pathnames, if any, it might have. >> You need an exhaustive, recursive search of the file system for the >>

Re: How to waste computer memory?

2016-03-19 Thread Chris Angelico
On Sat, Mar 19, 2016 at 8:31 PM, Marko Rauhamaa wrote: > Unicode made several (understandable but grave) mistakes along the way: > >* normalization > Elaborate please? What's such a big mistake here? ChrisA -- https://mail.python.org/mailman/listinfo/python-list

E-commerce system in Python

2016-03-19 Thread Arshpreet Singh
I am looking for an E-commerce system in python to sell things things online, which can also be responsive for Android and IOS. A quick Google search brought me http://getsaleor.com/ it uses Django, Is there any available one using Flask or newly born asyncio based framework? -- https://mail

Re: creating multiple python Django projects in Windows environment

2016-03-19 Thread Chris Angelico
On Sat, Mar 19, 2016 at 6:04 AM, jogaserbia wrote: > Can someone please give me ideas on what I should read about (or pay someone > to do) that would enable me to create a basis on which multiple Python (web > and non-web) applications can be access by staff in a windows environment. > You basi

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

2016-03-19 Thread Daniel Wilcox
I think you're looking for something like popitem(). >>> d = {'asdf':1} >>> d.popitem()[0] 'asdf' Cheers On Fri, Mar 18, 2016 at 2:33 PM, Fillmore wrote: > > 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", "cop

Re: sobering observation, python vs. perl

2016-03-19 Thread Charles T. Smith
On Thu, 17 Mar 2016 09:21:51 -0700, Ethan Furman wrote: >> well, I don't want to forgo REs in order to have python's numbers be >> better > > The issue is not avoiding REs, but using Python's strengths and idioms. > Write the code in Python's style, get the same results, then compare > t

Re: empty clause of for loops

2016-03-19 Thread Sven R. Kunze
On 16.03.2016 14:58, alister wrote: no , i just typed it, while trying to hold a conversation with swmbo :-( apologies to the op if e could not see where i was intending to go with this. No problem, I perform quite well at guessing folk's intention. So, yes, I can extrapolate what you meant.

Re: Beginner Python Help

2016-03-19 Thread Chris Warrick
On 18 Mar 2016 08:05, "Alan Gabriel" wrote: > > Hey there, > > 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)) >

Re: Bash-like pipes in Python

2016-03-19 Thread Random832
On Wed, Mar 16, 2016, at 11:09, Joel Goldstick wrote: > > This is interesting, but the part I'm missing is the use of the Pipe > symbol '|' in python. Can you elaborate His "Filter", "Map", and "Reduce" are classes which define __ror__ methods, obviously. -- https://mail.python.org/mailman/listi

Re: from a module return a class

2016-03-19 Thread kevind0718
On Friday, March 18, 2016 at 12:16:13 PM UTC-4, John Gordon wrote: > In Wolfgang Maier > writes: > > > > So promptUser_PWord is a module? Well, I'm confused. You gave us this > > > bit of code: > > > > > > user_pword = promptUser_PWord() > > > > > > But that can't work if promptUser_PWor

Re: How to waste computer memory?

2016-03-19 Thread Chris Angelico
On Sat, Mar 19, 2016 at 8:02 AM, 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 >>> completely. >>

Re: Need explanation of this error

2016-03-19 Thread Bryan Bateman
Having the same error with python 3.5 windows 64 bit and scipy for same on Windows 10. I did dependency walker and it came up with a large number of DLL's. Do you want the source of the scipy binary and the DLL list? https://mail.python.org/pipermail/python-list/2013-July/651190.html -- h

Re: How to waste computer memory?

2016-03-19 Thread Marko Rauhamaa
Chris Angelico : > On Sat, Mar 19, 2016 at 8:31 PM, Marko Rauhamaa wrote: >> Unicode made several (understandable but grave) mistakes along the way: >> >>* normalization > > Elaborate please? What's such a big mistake here? Unicode shouldn't have allowed multiple equivalent variants for a st

About PyPi: ETA from publish to searchable?

2016-03-19 Thread Daniel Wilcox
Hello! I just recently published my first package to PyPi and was wondering -- how long will it take before I actually can see it if I'm searching for it? I imagine the indexes are on some schedule but I'm chomping at the bit -- about how long is that? Thanks, -D https://pypi.python.org/pypi/vc

Re: WP-A: A New URL Shortener

2016-03-19 Thread Thomas 'PointedEars' Lahn
Rick Johnson wrote: > On Thursday, March 17, 2016 at 1:28:05 PM UTC-5, Thomas 'PointedEars' Lahn > wrote: > >> BTW and JFTR, this thread has gone *way* off topic. > Who cares? Python-list is not a "strictly moderated group". [rant] Get a life, *please*. -- PointedEars Twitter

Re: How to waste computer memory?

2016-03-19 Thread Random832
On Fri, Mar 18, 2016, at 10:59, Michael Torrie wrote: > This seems to me to be a leaky abstraction. Julia's approach is > interesting, but it strikes me as somewhat broken as it pretends to do > O(1) indexing, but in reality it's still O(n) because you still have to > iterate through the bytes unt

Re: Beautifulsoap

2016-03-19 Thread Peter Otten
epro...@gmail.com wrote: > > Yes, for my hobby i want extract odds. > > The code is: > > from bs4 import BeautifulSoup > > import urllib2 > > url = > "http://www.betexplorer.com/soccer/england/premier-league-2014-2015/results/"; > > content = urllib2.urlopen(url).read() > > soup = Beautiful

Re: Bash-like pipes in Python

2016-03-19 Thread Steven D'Aprano
On Thu, 17 Mar 2016 02:20 am, Random832 wrote: > How about: > > from functools import partial, reduce > from operator import mul > def rcall(arg, func): return func(arg) > def fpipe(*args): return reduce(rcall, args) > pfilter = partial(partial, filter) > pmap = partial(partial, map) > preduce =

Re: Case Statements

2016-03-19 Thread Marko Rauhamaa
BartC : > On 16/03/2016 14:31, Marko Rauhamaa wrote: >> Scheme has this: > >> (case (die10) >> ((1 3 5 7 9) >>=> (lambda (n) >> n)) >> (else >>=> (lambda (n) >> (/ n 2 >> >> which maps 1, 3, 5, 7 and 9 onto themselves but halves 2, 4, 6,

Re: sobering observation, python vs. perl

2016-03-19 Thread Marko Rauhamaa
"Charles T. Smith" : > On Thu, 17 Mar 2016 17:48:54 +0200, Marko Rauhamaa wrote: >> Try running the sed command again after setting: >> >> export LANG=C > > Hmmm. Interesting thought. But... > > $ locale > LANG=C Ok. The LANG=C setting has a tremendous effect on the performance of textutils.

Re: How to waste computer memory?

2016-03-19 Thread alister
On Fri, 18 Mar 2016 07:42:30 +1100, Chris Angelico wrote: > On Fri, Mar 18, 2016 at 7:31 AM, wrote: >> Rick Johnson wrote: >>> >>> In the event that i change my mind about Unicode, and/or for the sake >>> of others, who may want to know, please provide a list of languages >>> that *YOU* think h

RE: Replace weird error message?

2016-03-19 Thread Dan Strohl via Python-list
Actually, I think that was the complete code... give it a try... "{:02}".format("1") produces the error listed. I agree the error is not very clear, since the "=" was not passed, it seems like an incorrect error. What about something like: "ValueError: '=' and '0' padding are not allowed in s

Re: Obfuscating Python code

2016-03-19 Thread Daniel Wilcox
If you really want to learn about obfuscating python bytecode so it can't be reverse engineered (easily) -- there are people who are doing it. Search for 'pyasm' on github as a starting point. tldr; yes people are patching .pyc files. yes you can make them a nightmare to disassemble. and yes it sl

Re: How to waste computer memory?

2016-03-19 Thread Chris Angelico
On Fri, Mar 18, 2016 at 7:31 AM, wrote: > Rick Johnson wrote: >> >> In the event that i change my mind about Unicode, and/or for >> the sake of others, who may want to know, please provide a >> list of languages that *YOU* think handle Unicode better than >> Python, starting with the best first.

Re: How to waste computer memory?

2016-03-19 Thread Steven D'Aprano
On Sat, 19 Mar 2016 09:18 pm, Chris Angelico wrote: > On Sat, Mar 19, 2016 at 8:31 PM, Marko Rauhamaa wrote: >> Unicode made several (understandable but grave) mistakes along the way: >> >>* normalization >> > > Elaborate please? What's such a big mistake here? As usual, Unicode problems ar

  1   2   3   >