Re: how to get the ordinal number in list

2014-08-10 Thread Rustom Mody
On Monday, August 11, 2014 11:16:25 AM UTC+5:30, Chris Angelico wrote: > On Mon, Aug 11, 2014 at 3:23 PM, Rustom Mody wrote: > > A C programmer asked to swap variables x and y, typically writes something > > like > > t = x; x = y; y = t; > > Fine, since C cant do better. > > But then he assumes th

Re: What's the future of perfect Python?

2014-08-10 Thread Terry Reedy
On 8/11/2014 1:15 AM, 13813962782 wrote: "Java is belonging to Oracle, C++ is defined by ISO; Python is designed by great Guido van Rossum ; Python is owned, as in copyright and trademark, by the Python Software Foundation, a US non-profit corpor

Minimal Python Build in Docker Container

2014-08-10 Thread sprin . dev
Hello, I wanted to share what I've learned about making a reasonably minimal Docker image containing CPython built from source. Motivation: Many popular distros are not able to provide packaged builds of the desired Python version. Operators of co-tenanted Python services have struggled since

Re: how to get the ordinal number in list

2014-08-10 Thread Chris Angelico
On Mon, Aug 11, 2014 at 3:23 PM, Rustom Mody wrote: > A C programmer asked to swap variables x and y, typically writes something > like > > t = x; x = y; y = t; > > Fine, since C cant do better. > But then he assumes that that much sequentialization is inherent to the > problem... > Until he see

Re: What's the future of perfect Python?

2014-08-10 Thread Chris Angelico
On Mon, Aug 11, 2014 at 3:15 PM, 13813962782 <13813962...@139.com> wrote: > Just like MANY people, I was one of guys who do very like Python. But > there's one thing always puzzled me, could you kindly help give some words > about it: > "Java is belonging to Oracle, C++ is defined by ISO; Python is

Re: how to get the ordinal number in list

2014-08-10 Thread Rustom Mody
On Monday, August 11, 2014 12:33:59 AM UTC+5:30, Chris Angelico wrote: > On Mon, Aug 11, 2014 at 4:26 AM, Rustom Mody wrote: > > Its when we have variables that are assigned in multiple places that > > we start seeing mathematical abominations like > > x = x+1 > That's an abomination to you becaus

What's the future of perfect Python?

2014-08-10 Thread 13813962782
Hi Sir/Madam, Just like MANY people, I was one of guys who do very like Python. But there's one thing always puzzled me, could you kindly help give some words about it: "Java is belonging to Oracle, C++ is defined by ISO Python is designed by great Guido van Rossum then what is the futu

Re: Template language for random string generation

2014-08-10 Thread Paul Wolf
On Sunday, 10 August 2014 17:31:01 UTC+1, Steven D'Aprano wrote: > Devin Jeanpierre wrote: > > > > > On Fri, Aug 8, 2014 at 2:01 AM, Paul Wolf wrote: > > >> This is a proposal with a working implementation for a random string > > >> generation template syntax for Python. `strgen` is a module

Re: Template language for random string generation

2014-08-10 Thread Paul Wolf
On Sunday, 10 August 2014 17:47:48 UTC+1, Ian wrote: > On Sun, Aug 10, 2014 at 10:34 AM, Paul Wolf wrote: > > > For instance, a template language that validates the output would have to > > do frequency analysis. But that is getting too far off the purpose of > > strgen, although such a mechan

Re: how to get the ordinal number in list

2014-08-10 Thread Rustom Mody
On Monday, August 11, 2014 8:30:32 AM UTC+5:30, Steven D'Aprano wrote: > You did the same thing in your own course, the only difference being you > accepted a different set of primitive functions. But ultimately you have to > introduce *some* amount of concreteness, at some level, otherwise we're

Re: how to get the ordinal number in list

2014-08-10 Thread Rustom Mody
On Monday, August 11, 2014 3:31:08 AM UTC+5:30, Roy Smith wrote: > Mark Lawrence wrote: > > On 10/08/2014 19:26, Rustom Mody wrote: > > > Its when we have variables that are assigned in multiple places that > > > we start seeing mathematical abominations like > > > x = x+1 > > I'm not bothered a

Re: how to get the ordinal number in list

2014-08-10 Thread Steven D'Aprano
Rustom Mody wrote: > On Sunday, August 10, 2014 10:40:21 PM UTC+5:30, Roy Smith wrote: >> Rustom Mody wrote: > >> > > They haven't figured out yet that the >> > > first step to solving a problem is to decide what algorithms you're >> > > going to use, and only then can you start translating tha

Re: Template language for random string generation

2014-08-10 Thread Chris Angelico
On Mon, Aug 11, 2014 at 12:22 PM, Steven D'Aprano wrote: > You mean the opposite to OpenSSL, which was handed down to Mankind from > the Gods? I thought Prometheus stole OpenSSL and gave it to mankind so a group of Minotaurs would stop teasing him about Heartbleed. ChrisA -- https://mail.python

Re: Template language for random string generation

2014-08-10 Thread Steven D'Aprano
Devin Jeanpierre wrote: > On Sun, Aug 10, 2014 at 9:31 AM, Steven D'Aprano > wrote: >> I don't think that using a good, but not cryptographically-strong, random >> number generator to generate passwords is a serious vulnerability. What's >> your threat model? > > I've always wanted a password g

Re: how to get the ordinal number in list

2014-08-10 Thread Steven D'Aprano
Rustom Mody wrote: > Its when we have variables that are assigned in multiple places that > we start seeing mathematical abominations like > x = x+1 That's not a mathematical abomination. It's a perfectly reasonable mathematical equation, one with no solutions since the line f(x) = x and the line

Re: how to get the ordinal number in list

2014-08-10 Thread ismeal shanshi
Herion, Ketamine,Actavis promethazine codeine 16oz and 32oz available , Oxycontine Hydrocodone xanax and medicated marijuana US- free shipping and other related products for sell at competitive prices.We do world wide shipping to any clear address.Delivery is 100% safe due to our discreetness

Re: why i can't copy mail with imaplib?

2014-08-10 Thread Ben Finney
luofeiyu writes: > >>> x.con.copy(b"1","[Gmail]/Important") > ('NO', [b'[TRYCREATE] No folder [Gmail]/Important (Failure)']) Your questions have mostly been unrelated to Python, and this is another example. You should search elsewhere for assistance with IMAP and GMail. -- \“The restr

Re: why i can't copy mail with imaplib?

2014-08-10 Thread luofeiyu
>>> x.con.list() ('OK', [b'(\\HasNoChildren) "/" "INBOX"', b'(\\Noselect \\HasChildren) "/" "[Gma il]"', b'(\\HasNoChildren \\Junk) "/" "[Gmail]/&V4NXPpCuTvY-"', b'(\\HasNoChildr en \\Trash) "/" "[Gmail]/&XfJSIJZkkK5O9g-"', b'(\\HasNoChildren \\Flagged) "/" " [Gmail]/&XfJSoGYfaAc-"', b'(\\HasNo

Re: why i can't copy mail with imaplib?

2014-08-10 Thread John Gordon
In luofeiyu writes: > self.con.select("inbox") > self.con.copy(b"1","[Gmail]/&kc2JgQ-]") > why i can not copy the first email into my important mailbox? What happens when you run the above code? Do you get an error? -- John Gordon Imagine what it must be like for a real medical do

Re: how to get the ordinal number in list

2014-08-10 Thread Chris Angelico
On Mon, Aug 11, 2014 at 8:01 AM, Roy Smith wrote: > I'm with Mark. This isn't math, it's programming. Sure, the > intersection of the two is non-null, but they are different things. > I'll often do things like: > > for line in input: >line = line.strip() ># do more stuff What does mathe

Re: Idle crashes when using accentuated letters in Mac OS X

2014-08-10 Thread Ned Deily
In article , Christian Gollwitzer wrote: > Am 10.08.14 15:03, schrieb Anamaria Martins Moreira > > I am facing a problem with using accentuated characters in idle (2.7.6 > > or 2.7.8). When I type the accent, idle crashes. If I call python from a > > terminal, there is no such problem. > > Try u

Re: how to get the ordinal number in list

2014-08-10 Thread Roy Smith
In article , Mark Lawrence wrote: > On 10/08/2014 19:26, Rustom Mody wrote: > > > > Its when we have variables that are assigned in multiple places that > > we start seeing mathematical abominations like > > x = x+1 > > > > I'm not bothered about it being a mathematical or any other type of >

Re: Idle crashes when using accentuated letters in Mac OS X

2014-08-10 Thread Christian Gollwitzer
Am 10.08.14 15:03, schrieb Anamaria Martins Moreira I am facing a problem with using accentuated characters in idle (2.7.6 or 2.7.8). When I type the accent, idle crashes. If I call python from a terminal, there is no such problem. Try updating your Tcl/Tk to the latest version, e.g. via Active

Re: how to get the ordinal number in list

2014-08-10 Thread Mark Lawrence
On 10/08/2014 19:26, Rustom Mody wrote: Its when we have variables that are assigned in multiple places that we start seeing mathematical abominations like x = x+1 I'm not bothered about it being a mathematical or any other type of abomination. It works, practically beats purity, so if it a

Re: Template language for random string generation

2014-08-10 Thread Chris Angelico
On Mon, Aug 11, 2014 at 2:31 AM, Steven D'Aprano wrote: > Personally, I think even the OP's specified language is too complex. For > example, it supports literal text, but given the use-case (password > generators) do we really want to support templates like "password[\d]"? I > don't think so, and

Re: how to get the ordinal number in list

2014-08-10 Thread Chris Angelico
On Mon, Aug 11, 2014 at 5:14 AM, Marko Rauhamaa wrote: > Chris Angelico : > >> In computing, assignment and reassignment aren't at all problematic, >> and neither is printing to the console, so please stop telling people >> off for using them. > > Printing to the console is somewhat problematic: >

Re: how to get the ordinal number in list

2014-08-10 Thread Marko Rauhamaa
Chris Angelico : > In computing, assignment and reassignment aren't at all problematic, > and neither is printing to the console, so please stop telling people > off for using them. Printing to the console is somewhat problematic: >>> with open("/dev/console", "w") as console: console.write("

Re: how to get the ordinal number in list

2014-08-10 Thread Chris Angelico
On Mon, Aug 11, 2014 at 4:26 AM, Rustom Mody wrote: > > Its when we have variables that are assigned in multiple places that > we start seeing mathematical abominations like > x = x+1 That's an abomination to you because it breaks your mathematical model. It's fine to a computer, which has a sens

Re: Template language for random string generation

2014-08-10 Thread Devin Jeanpierre
On Sun, Aug 10, 2014 at 9:31 AM, Steven D'Aprano wrote: >> (I've been working on this kind of thing with regexps, but it's still >> incomplete.) >> >>> * Uses SystemRandom class (if available, or falls back to Random) >> >> This sounds cryptographically weak. Isn't the normal thing to do to >> use

Re: Template language for random string generation

2014-08-10 Thread Devin Jeanpierre
On Sun, Aug 10, 2014 at 9:34 AM, Paul Wolf wrote: > * No one will want to write that expression We've already established that one to be wrong. ;) > * The regex expression doesn't work anyway That's a cheap swipe. The regexp doesn't work because I used a colon instead of a comma, because I acci

Re: how to get the ordinal number in list

2014-08-10 Thread Rustom Mody
On Sunday, August 10, 2014 11:44:23 PM UTC+5:30, Roy Smith wrote: > Rustom Mody wrote: > > >>> l= [6,2,9,12,1,4] > > >>> sorted(l,reverse=True)[:5] > > [12, 9, 6, 4, 2] > > No need to know how sorted works nor [:5] > > Now you (or Steven) can call it abstract. > > And yet its > > 1. Actual runni

Re: how to get the ordinal number in list

2014-08-10 Thread Roy Smith
In article <154cc342-7f85-4d16-b636-a1a953913...@googlegroups.com>, Rustom Mody wrote: > >>> l= [6,2,9,12,1,4] > >>> sorted(l,reverse=True)[:5] > [12, 9, 6, 4, 2] > > No need to know how sorted works nor [:5] > > Now you (or Steven) can call it abstract. > > And yet its > 1. Actual running c

Re: how to get the ordinal number in list

2014-08-10 Thread Rustom Mody
Pressed Send to early. On Sunday, August 10, 2014 11:15:03 PM UTC+5:30, Rustom Mody wrote: > >>> # Works the same (SEEMINGLY) > ... # Now change the return to an yield > ... > >>> def search(x,y): > ...for id ,value in enumerate(x): > ...if y==value : yield id > ... > >>> search

Re: how to get the ordinal number in list

2014-08-10 Thread Rustom Mody
On Saturday, August 9, 2014 7:53:22 AM UTC+5:30, luofeiyu wrote: > >>> x=["x1","x3","x7","x5"] > >>> y="x3" > how can i get the ordinal number by some codes? > for id ,value in enumerate(x): > if y==value : print(id) > Is more simple way to do that? I feel a bit discourteous going on a

Re: how to get the ordinal number in list

2014-08-10 Thread Rustom Mody
On Sunday, August 10, 2014 10:40:21 PM UTC+5:30, Roy Smith wrote: > Rustom Mody wrote: > > > They haven't figured out yet that the > > > first step to solving a problem is to decide what algorithms you're > > > going to use, and only then can you start translating that into code. > > > They

Re: how to get the ordinal number in list

2014-08-10 Thread Steven D'Aprano
Rustom Mody wrote: > On Saturday, August 9, 2014 9:04:22 PM UTC+5:30, Roy Smith wrote: [...] >> They haven't figured out yet that the >> first step to solving a problem is to decide what algorithms you're >> going to use, and only then can you start translating that into code. >> They need to be l

Re: how to get the ordinal number in list

2014-08-10 Thread Roy Smith
In article , Rustom Mody wrote: > > They haven't figured out yet that the > > first step to solving a problem is to decide what algorithms you're > > going to use, and only then can you start translating that into code. > > They need to be led in small steps towards basic knowledge. > [...]

why i can't copy mail with imaplib?

2014-08-10 Thread luofeiyu
Help on method copy in module imaplib: copy(message_set, new_mailbox) method of imaplib.IMAP4_SSL instance Copy 'message_set' messages onto end of 'new_mailbox'. (typ, [data]) = .copy(message_set, new_mailbox) self is an instance in my code."[Gmail]/&kc2JgQ-]" is the important mailbox.

Idle crashes when using accentuated letters in Mac OS X

2014-08-10 Thread Anamaria Martins Moreira
Hi! I am facing a problem with using accentuated characters in idle (2.7.6 or 2.7.8). When I type the accent, idle crashes. If I call python from a terminal, there is no such problem. I looked around and saw that there are a number of issues with utf-8-python-mac, but I could not find the solutio

Re: Template language for random string generation

2014-08-10 Thread Ian Kelly
On Sun, Aug 10, 2014 at 10:34 AM, Paul Wolf wrote: > For instance, a template language that validates the output would have to do > frequency analysis. But that is getting too far off the purpose of strgen, > although such a mechanism would certainly have its place. I don't think that would be

Re: Template language for random string generation

2014-08-10 Thread Ian Kelly
On Aug 10, 2014 6:45 AM, "Devin Jeanpierre" wrote: > > * Uses SystemRandom class (if available, or falls back to Random) > > This sounds cryptographically weak. Isn't the normal thing to do to > use a cryptographic hash function to generate a pseudorandom sequence? You mean in the fallback case,

Re: Template language for random string generation

2014-08-10 Thread Paul Wolf
On Sunday, 10 August 2014 13:43:04 UTC+1, Devin Jeanpierre wrote: > On Fri, Aug 8, 2014 at 2:01 AM, Paul Wolf wrote: > > > This is a proposal with a working implementation for a random string > > generation template syntax for Python. `strgen` is a module for generating > > random strings in P

Re: Template language for random string generation

2014-08-10 Thread Steven D'Aprano
Devin Jeanpierre wrote: > On Fri, Aug 8, 2014 at 2:01 AM, Paul Wolf wrote: >> This is a proposal with a working implementation for a random string >> generation template syntax for Python. `strgen` is a module for >> generating random strings in Python using a regex-like template language. >> Exa

Re: how to get the ordinal number in list

2014-08-10 Thread Rustom Mody
On Saturday, August 9, 2014 9:04:22 PM UTC+5:30, Roy Smith wrote: > Rustom Mody wrote: > > [To the OP] > > Yeah I am in the minority at least out here in considering > > comprehensions simpler than loops. Take your pick > When comprehensions first came out, I stubbornly refused to get my head

Re: get the min date from a list

2014-08-10 Thread Roy Smith
In article , Dave Angel wrote: > Your simplest answer is probably to write a function that converts > a string like you have into a datetime object, say call it > converter (). Then after testing it, you call > > min (dates, key = converter) Wow, after all these years, I didn't know min() to

Re: Template language for random string generation

2014-08-10 Thread Devin Jeanpierre
On Fri, Aug 8, 2014 at 2:01 AM, Paul Wolf wrote: > This is a proposal with a working implementation for a random string > generation template syntax for Python. `strgen` is a module for generating > random strings in Python using a regex-like template language. Example: > > >>> from strgen i

Re:get the min date from a list

2014-08-10 Thread Dave Angel
luofeiyu Wrote in message: > >>> date > ['Sat, 09 Aug 2014 07:36:46 -0700', 'Fri, 8 Aug 2014 22:25:40 -0400', > 'Sat, 9 Au > g 2014 12:46:43 +1000', 'Sat, 9 Aug 2014 12:50:52 +1000', 'Sat, 9 Aug > . > 2014 03:4 > 4:56 +0200', 'Sun, 10 Aug 2014 01:55:24 + (UTC)', 'Sun, 10 Aug 2014

Re: get the min date from a list

2014-08-10 Thread Mark Lawrence
On 10/08/2014 08:14, luofeiyu wrote: >>> date ['Sat, 09 Aug 2014 07:36:46 -0700', 'Fri, 8 Aug 2014 22:25:40 -0400', 'Sat, 9 Au g 2014 12:46:43 +1000', 'Sat, 9 Aug 2014 12:50:52 +1000', 'Sat, 9 Aug 2014 02:51 :01 + (UTC)', 'Sat, 9 Aug 2014 13:03:24 +1000', 'Sat, 09 Aug 2014 13:06:28 + 1000',

get the min date from a list

2014-08-10 Thread luofeiyu
>>> date ['Sat, 09 Aug 2014 07:36:46 -0700', 'Fri, 8 Aug 2014 22:25:40 -0400', 'Sat, 9 Au g 2014 12:46:43 +1000', 'Sat, 9 Aug 2014 12:50:52 +1000', 'Sat, 9 Aug 2014 02:51 :01 + (UTC)', 'Sat, 9 Aug 2014 13:03:24 +1000', 'Sat, 09 Aug 2014 13:06:28 + 1000', 'Fri, 8 Aug 2014 20:48:44 -0700 (PDT

Re: how to get the subject of email?

2014-08-10 Thread Mark Lawrence
On 10/08/2014 02:41, luofeiyu wrote: I am in python3.4 typ, data = x.con.fetch(b'1', '(RFC822)') #get the first email text = data[0][1] message = email.message_from_string(text).get('subject') Traceback (most recent call last): File "", line 1, in File "D:\Python34\lib\email\__init__.

Re: Fwd: How to draw a map using python

2014-08-10 Thread Mark Lawrence
On 10/08/2014 02:44, Yuanchao Xu wrote: To kind whom it may concern: I want to draw a map using python, not really a map with full information, just a get together of a series of small shapes to reflect land use. The data is like below |1 2 2 3 3 2 2 3 3 1 1 2 1 1 1 1 3 3 3 3

Re: how to write file into my android phone?

2014-08-10 Thread Marko Rauhamaa
Christian Gollwitzer : > Am 10.08.14 11:39, schrieb Steven D'Aprano: >> Android phones don't mount as storage devices? >> Oh well, that's Android crossed off my list. > > Not any longer. They used to, but the support for mass storage was > dropped in favour of MTP I don't see anything inherently

Re: how to write file into my android phone?

2014-08-10 Thread Christian Gollwitzer
Am 10.08.14 11:39, schrieb Steven D'Aprano: Android phones don't mount as storage devices? Oh well, that's Android crossed off my list. Not any longer. They used to, but the support for mass storage was dropped in favour of MTP to allow concurrent access from both the computer and the phone

Re: how to write file into my android phone?

2014-08-10 Thread Steven D'Aprano
Chris “Kwpolska” Warrick wrote: > On Sun, Aug 10, 2014 at 12:23 AM, Dave Angel wrote: >> 1) it's not necessarily j: And not necessarily a single drive. > > The OP claims it is a J: drive they want to write to. > >> 2) the phone isn't necessarily visible on a pc as a drive at all. >> For exam

Re: How to draw a map using python

2014-08-10 Thread Ian Kelly
On Sat, Aug 9, 2014 at 7:44 PM, Yuanchao Xu wrote: > 1. I wonder in python, is there any more fast way to generate this kind of > map, as a whole, not a series of shapes, i think that would be faster?? You mean like collecting all the shapes into a single sparse array and passing the single array

Re: how to write file into my android phone?

2014-08-10 Thread Chris “Kwpolska” Warrick
On Sun, Aug 10, 2014 at 12:23 AM, Dave Angel wrote: > 1) it's not necessarily j: And not necessarily a single drive. The OP claims it is a J: drive they want to write to. > 2) the phone isn't necessarily visible on a pc as a drive at all. > For example the Samsung gs4. This is actually true

Re: The "right" way to use config files

2014-08-10 Thread Fabien
On 10.08.2014 00:30, Terry Reedy wrote: The advantage of TDD is that it forces one to make code testable as you do. Thanks a lot, Terry, for your comprehensive example! -- https://mail.python.org/mailman/listinfo/python-list