Re: even faster heaps

2016-03-07 Thread srinivas devaki
Hi, sorry i didn't get to your last mail as i'm having exams at that time. Everything is good so far. but if at all the purpose is to add features to the stdlib heap and keeping the speed offered by the stdlib, why aren't you allowing the duplicate elements which is possible with stdlib heap. to

Re: Pyhon 2.x or 3.x, which is faster?

2016-03-07 Thread Steven D'Aprano
On Tuesday 08 March 2016 12:41, BartC wrote: > On 08/03/2016 01:19, Steven D'Aprano wrote: >> On Tue, 8 Mar 2016 07:19 am, BartC wrote: >> >>> I don't have to hand a jpeg file that it can't >>> decode. >> >> Run this under Python 2: >> >> from random import randint >> blob = [randint(0, 256) for i

Re: Pyhon 2.x or 3.x, which is faster?

2016-03-07 Thread Terry Reedy
On 3/7/2016 7:22 PM, BartC wrote: (Is a byte string the same as a byte array? No, if by 'byte array' mean (mutable) bytearray. Yes, in the sense that a byte string is an (immutable) array of ints in range(256). Is a byte array the same as an array.array? No, if by 'byte array' you mean th

Re: Pyhon 2.x or 3.x, which is faster?

2016-03-07 Thread Mark Lawrence
On 08/03/2016 03:39, Terry Reedy wrote: On 3/7/2016 8:33 PM, BartC wrote: On Tue, Mar 8, 2016 at 12:00 PM, BartC wrote: def whiletest(): | i=0 | while i<=1: | | i+=1 whiletest() Python 2.7: 8.4 seconds Python 3.1: 12.5 seconds Python 3.4: 18.0 seconds Even if you don't ca

Re: breaking out of outer loops

2016-03-07 Thread Mark Lawrence
On 07/03/2016 23:09, Fillmore wrote: I must be missing something simple because I can't find a way to break out of a nested loop in Python. Is there a way to label loops? For the record, here's a Perl script of mine I'm trying to port...there may be 'malformed' lines in a TSV file I'm parsing

Re: Pyhon 2.x or 3.x, which is faster?

2016-03-07 Thread Terry Reedy
On 3/7/2016 8:33 PM, BartC wrote: On Tue, Mar 8, 2016 at 12:00 PM, BartC wrote: def whiletest(): | i=0 | while i<=1: | | i+=1 whiletest() Python 2.7: 8.4 seconds Python 3.1: 12.5 seconds Python 3.4: 18.0 seconds Even if you don't care about speed, you must admit that there

Re: breaking out of outer loops

2016-03-07 Thread Terry Reedy
On 3/7/2016 6:49 PM, Chris Angelico wrote: On Tue, Mar 8, 2016 at 10:42 AM, Chris Kaynor wrote: And the same rough example, using an exception without a function: for file in files: try: for line in file: section = line.split() for section in line:

Re: Pyhon 2.x or 3.x, which is faster?

2016-03-07 Thread Mark Lawrence
On 07/03/2016 11:38, BartC wrote: On 07/03/2016 11:11, Marko Rauhamaa wrote: BartC : I've also found that 3 was consistently slower than 2 on various benchmarks. Perhaps 10 to 20% slower (also 3.4 vs. 2.7). Python doesn't exist for performance-critical parts of your solution. Also, Python pr

Re: Pyhon 2.x or 3.x, which is faster?

2016-03-07 Thread MRAB
On 2016-03-08 01:33, BartC wrote: On 08/03/2016 01:23, Chris Angelico wrote: On Tue, Mar 8, 2016 at 12:00 PM, BartC wrote: Yes of course it does. As does 'being slow'. Take another microbenchmark: def whiletest(): | i=0 | while i<=1: | | i+=1 whiletest() Python 2.7: 8.4 sec

Re: Pyhon 2.x or 3.x, which is faster?

2016-03-07 Thread Mark Lawrence
On 08/03/2016 01:47, BartC wrote: On 08/03/2016 01:12, Mark Lawrence wrote: On 08/03/2016 01:00, BartC wrote: If your efforts manage to double the speed of reading file A, then probably the reading file B is also going to be improved! In practice you use a variety of files, but one at a time w

Re: fnmatch() vs. glob.glob()

2016-03-07 Thread MRAB
On 2016-03-08 01:37, Jinghui Niu wrote: On Monday, March 7, 2016 at 5:16:44 PM UTC-8, Ben Finney wrote: Jinghui Niu writes: > May I take this opportunity to ask a bold question for a beginner No problem, your questions are on topic here. Thank you for being civil. > if I want to mimic Sublim

Re: Pyhon 2.x or 3.x, which is faster?

2016-03-07 Thread Ben Finney
BartC writes: > On 08/03/2016 01:40, Chris Angelico wrote: > > You need to be VERY clear about exactly what you're measuring. Are > > you using the 'timeit' module to measure execution of one line of > > code? Are you putting your code into a file and running that with > > /usr/bin/time? Are you

Re: fnmatch() vs. glob.glob()

2016-03-07 Thread Steven D'Aprano
On Tue, 8 Mar 2016 12:04 pm, Jinghui Niu wrote: > May I take this opportunity to ask a bold question for a beginner: if I > want to mimic Sublime Text's fuzzy search for a file search in given > directories, which module of these two would be more suitable? Could you > shed some insights? Thanks.

Re: Pyhon 2.x or 3.x, which is faster?

2016-03-07 Thread Steven D'Aprano
On Tue, 8 Mar 2016 09:39 am, BartC wrote: > On 07/03/2016 20:47, Chris Angelico wrote: >> On Tue, Mar 8, 2016 at 7:19 AM, BartC wrote: > >>> What can be more perfect for comparing two implementations? > >> rosuav@sikorsky:~$ python2 -m timeit -s 'from fp import Float' >> 'Float("1234.567")' >>

Re: Pyhon 2.x or 3.x, which is faster?

2016-03-07 Thread BartC
On 08/03/2016 01:40, Chris Angelico wrote: On Tue, Mar 8, 2016 at 12:33 PM, BartC wrote: Let me ask you a follow-on question first: how slow does a new Python version have to be before even you would take notice? Compared with 2.7, 3.4 above is spending nearly an extra ten seconds doing

Re: Question

2016-03-07 Thread justin walters
Well, from that error message, it seems like you may have a permissions issue. Also, the git shell is not the sane as a real shell. There are multiple windows terminal emulators. Why not use one of those? On Mar 7, 2016 5:46 PM, "Jon Ribbens" wrote: > On 2016-03-07, Ian Kelly wrote: > > On Mon,

Re: fnmatch() vs. glob.glob()

2016-03-07 Thread Chris Angelico
On Tue, Mar 8, 2016 at 12:37 PM, Jinghui Niu wrote: > Let me try to describe the behaviours as much as I can here: It is a > real-time search, updating the search result as you type; It is very smart, > not limiting itself into the verbatim words, but extracting feature strings > automatically,

Re: fnmatch() vs. glob.glob()

2016-03-07 Thread Ben Finney
Jinghui Niu writes: > Let me try to describe the behaviours as much as I can here: It is a > real-time search, updating the search result as you type; It is very > smart, not limiting itself into the verbatim words, but extracting > feature strings automatically, e.g., typing "fontz" will match n

Re: Pyhon 2.x or 3.x, which is faster?

2016-03-07 Thread Chris Angelico
On Tue, Mar 8, 2016 at 12:34 PM, Steven D'Aprano wrote: > On Tue, 8 Mar 2016 07:47 am, Chris Angelico wrote: > >> You write *real world* code and then profile that. You get actual real >> programs that you actually really use, and you run those through >> timing harnesses. > > > Chris, I think tha

Re: Pyhon 2.x or 3.x, which is faster?

2016-03-07 Thread BartC
On 08/03/2016 01:12, Mark Lawrence wrote: On 08/03/2016 01:00, BartC wrote: If your efforts manage to double the speed of reading file A, then probably the reading file B is also going to be improved! In practice you use a variety of files, but one at a time will do. What is the difference i

Re: Pyhon 2.x or 3.x, which is faster?

2016-03-07 Thread BartC
On 08/03/2016 01:19, Steven D'Aprano wrote: On Tue, 8 Mar 2016 07:19 am, BartC wrote: I don't have to hand a jpeg file that it can't decode. Run this under Python 2: from random import randint blob = [randint(0, 256) for i in range(16*1024)] with open('broken.jpg', 'wb') as f: f.wri

Re: Question

2016-03-07 Thread Jon Ribbens
On 2016-03-07, Ian Kelly wrote: > On Mon, Mar 7, 2016 at 11:51 AM, Jon Ribbens > wrote: >> I must say that Python on Windows was a very poor experience indeed, >> "virtualenv" does not work and "venv" refuses to create the 'activate' >> shell script so does not work either > > I've used both of th

Re: Pyhon 2.x or 3.x, which is faster?

2016-03-07 Thread Chris Angelico
On Tue, Mar 8, 2016 at 12:33 PM, BartC wrote: > On 08/03/2016 01:23, Chris Angelico wrote: >> >> On Tue, Mar 8, 2016 at 12:00 PM, BartC wrote: >>> >>> Yes of course it does. As does 'being slow'. Take another microbenchmark: >>> >>> def whiletest(): >>> | i=0 >>> | while i<=1: >>> |

Re: fnmatch() vs. glob.glob()

2016-03-07 Thread Jinghui Niu
On Monday, March 7, 2016 at 5:16:44 PM UTC-8, Ben Finney wrote: > Jinghui Niu writes: > > > May I take this opportunity to ask a bold question for a beginner > > No problem, your questions are on topic here. Thank you for being civil. > > > if I want to mimic Sublime Text's fuzzy search for a f

Re: Question

2016-03-07 Thread Jon Ribbens
On 2016-03-07, Chris Angelico wrote: > 3) Use standard Python, and ditch Windows. This is what I do. :) This is also what I do nearly all of the time, but for PyWeek I needed a computer running Python that actually had a monitor attached ;-) Although to be fair, Python under Ubuntu Server has fo

Re: Pyhon 2.x or 3.x, which is faster?

2016-03-07 Thread Ben Finney
BartC writes: > Let me ask you a follow-on question first: how slow does a new Python > version have to be before even you would take notice? Slow *at doing what*, in particular? It matters which specific operation we're discussing. -- \ “The generation of random numbers is too importan

Re: Pyhon 2.x or 3.x, which is faster?

2016-03-07 Thread Steven D'Aprano
On Tue, 8 Mar 2016 07:47 am, Chris Angelico wrote: > You write *real world* code and then profile that. You get actual real > programs that you actually really use, and you run those through > timing harnesses. Chris, I think that's exactly what BartC has done: he has a program that he actually

Re: Pyhon 2.x or 3.x, which is faster?

2016-03-07 Thread BartC
On 08/03/2016 01:23, Chris Angelico wrote: On Tue, Mar 8, 2016 at 12:00 PM, BartC wrote: Yes of course it does. As does 'being slow'. Take another microbenchmark: def whiletest(): | i=0 | while i<=1: | | i+=1 whiletest() Python 2.7: 8.4 seconds Python 3.1: 12.5 seconds Pytho

Re: Pyhon 2.x or 3.x, which is faster?

2016-03-07 Thread Chris Angelico
On Tue, Mar 8, 2016 at 12:00 PM, BartC wrote: > Yes of course it does. As does 'being slow'. Take another microbenchmark: > > def whiletest(): > | i=0 > | while i<=1: > | | i+=1 > > whiletest() > > Python 2.7: 8.4 seconds > Python 3.1: 12.5 seconds > Python 3.4: 18.0 seconds > > E

Re: Pyhon 2.x or 3.x, which is faster?

2016-03-07 Thread Steven D'Aprano
On Tue, 8 Mar 2016 07:19 am, BartC wrote: > I don't have to hand a jpeg file that it can't > decode. Run this under Python 2: from random import randint blob = [randint(0, 256) for i in range(16*1024)] with open('broken.jpg', 'wb') as f: f.write(''.join(blob)) If your software can de

Re: fnmatch() vs. glob.glob()

2016-03-07 Thread Ben Finney
Jinghui Niu writes: > May I take this opportunity to ask a bold question for a beginner No problem, your questions are on topic here. Thank you for being civil. > if I want to mimic Sublime Text's fuzzy search for a file search in > given directories, which module of these two would be more sui

Re: Pyhon 2.x or 3.x, which is faster?

2016-03-07 Thread Mark Lawrence
On 08/03/2016 01:00, BartC wrote: If your efforts manage to double the speed of reading file A, then probably the reading file B is also going to be improved! In practice you use a variety of files, but one at a time will do. What is the difference in your timing when you first read the file,

Re: Pyhon 2.x or 3.x, which is faster?

2016-03-07 Thread BartC
On 08/03/2016 00:05, Ben Finney wrote: BartC writes: On 07/03/2016 20:47, Chris Angelico wrote: Look! Creating a floating-point value is faster under Python 2 than Python 3. What could be more perfect? This is like a microbenchmark in that it doesn't tell you anything about real-world usag

Re: fnmatch() vs. glob.glob()

2016-03-07 Thread Jinghui Niu
On Monday, March 7, 2016 at 5:00:57 PM UTC-8, Ben Finney wrote: > Jinghui Niu writes: > > > Thank you for your reply. So if for a beginner learner who doesn't > > care so much about Unix-compliant, which one is a better choice for > > learning purpose? > > Learn to care about the difference :-)

Re: fnmatch() vs. glob.glob()

2016-03-07 Thread Ben Finney
Jinghui Niu writes: > Thank you for your reply. So if for a beginner learner who doesn't > care so much about Unix-compliant, which one is a better choice for > learning purpose? Learn to care about the difference :-) They are both useful and both do different things. -- \ “I must say tha

Re: fnmatch() vs. glob.glob()

2016-03-07 Thread Jinghui Niu
On Monday, March 7, 2016 at 1:37:45 PM UTC-8, Ben Finney wrote: > Jinghui Niu writes: > > > Hi, I've been studying python 3 modules. I'm a bit confused about the > > possibly overlap between fnmatch() and glob(), they seem to achieve > > the same goals exactly. Why duplicate? > > >From the modul

Re: Pyhon 2.x or 3.x, which is faster?

2016-03-07 Thread MRAB
On 2016-03-08 00:22, BartC wrote: On 07/03/2016 23:40, Chris Angelico wrote: On Tue, Mar 8, 2016 at 9:39 AM, BartC wrote: I'm using it because this kind of file reading in Python is a mess. If I do a read, will I get a string, a byte sequence object, a byte-array, or array-array, or what?

Re: Pyhon 2.x or 3.x, which is faster?

2016-03-07 Thread Chris Angelico
On Tue, Mar 8, 2016 at 11:22 AM, BartC wrote: > > (Is a byte string the same as a byte array? Is a byte array the same as an > array.array? If I remove this line from my code, where 'data' has just been > read from a file: > >data=array.array('B',data) > > then it still works - Python 3. But n

Re: Pyhon 2.x or 3.x, which is faster?

2016-03-07 Thread Mark Lawrence
On 08/03/2016 00:22, BartC wrote: The slow speed of Python (and a number of other scripting languages) is well known. But obviously that is not any sort of issue, and these people working flat out on tracing JIT compilers are all wasting their time too! The slow speed of Python hasn't stoppe

Re: breaking out of outer loops

2016-03-07 Thread Mark Lawrence
On 07/03/2016 23:09, Fillmore wrote: I must be missing something simple because I can't find a way to break out of a nested loop in Python. Is there a way to label loops? For the record, here's a Perl script of mine I'm trying to port...there may be 'malformed' lines in a TSV file I'm parsing

Re: Pyhon 2.x or 3.x, which is faster?

2016-03-07 Thread BartC
On 07/03/2016 23:40, Chris Angelico wrote: On Tue, Mar 8, 2016 at 9:39 AM, BartC wrote: I'm using it because this kind of file reading in Python is a mess. If I do a read, will I get a string, a byte sequence object, a byte-array, or array-array, or what? Uhh you'll get either a text st

Re: breaking out of outer loops

2016-03-07 Thread Joel Goldstick
On Mon, Mar 7, 2016 at 7:13 PM, Fillmore wrote: > On 3/7/2016 7:08 PM, Chris Angelico wrote: > > >> Yep, which is why we're offering a variety of new paradigms. Because >> it's ever so much easier to get your head around three than one! >> >> We are SO helpful, guys. So helpful. :) >> > > not too

Re: breaking out of outer loops

2016-03-07 Thread Fillmore
On 3/7/2016 7:08 PM, Chris Angelico wrote: Yep, which is why we're offering a variety of new paradigms. Because it's ever so much easier to get your head around three than one! We are SO helpful, guys. So helpful. :) not too dissimilarly from human languages, speaking a foreign language is

What will I get when reading from a file? (was: Pyhon 2.x or 3.x, which is faster?)

2016-03-07 Thread Ben Finney
BartC writes: > I'm using [a third-party library function] because this kind of file > reading in Python is a mess. If I do a read, will I get a string, a > byte sequence object, a byte-array, or array-array, or what? That's a strange statement; there is virtually no mystery in what you'll get f

Re: breaking out of outer loops

2016-03-07 Thread Chris Angelico
On Tue, Mar 8, 2016 at 11:02 AM, Fillmore wrote: > On 3/7/2016 6:09 PM, Fillmore wrote: >> >> >> I must be missing something simple because I can't find a way to break >> out of a nested loop in Python. > > > Thanks to everyone who has tried to help so far. I suspect this may be a > case where I j

Re: Pyhon 2.x or 3.x, which is faster?

2016-03-07 Thread Ben Finney
BartC writes: > On 07/03/2016 20:47, Chris Angelico wrote: > > Look! Creating a floating-point value is faster under Python 2 than > > Python 3. What could be more perfect? > > > This is like a microbenchmark in that it doesn't tell you anything > > about real-world usage. > > Microbenchmarks hav

Re: breaking out of outer loops

2016-03-07 Thread Fillmore
On 3/7/2016 6:09 PM, Fillmore wrote: I must be missing something simple because I can't find a way to break out of a nested loop in Python. Thanks to everyone who has tried to help so far. I suspect this may be a case where I just need to get my head around a new paradigm -- https://mail.

Re: breaking out of outer loops

2016-03-07 Thread Chris Angelico
On Tue, Mar 8, 2016 at 10:42 AM, Chris Kaynor wrote: > And the same rough example, using an exception without a function: > > for file in files: > try: > for line in file: > section = line.split() > for section in line: > if sectionCorrupt: >

Re: breaking out of outer loops

2016-03-07 Thread Chris Angelico
On Tue, Mar 8, 2016 at 10:09 AM, Fillmore wrote: > For the record, here's a Perl script of mine I'm trying to port...there may > be 'malformed' lines in a TSV file I'm parsing that are better discarded > than fixed. > > my $ctr = 0; > OUTER: > while($line = ) { > > $ctr++; > if ($ctr < 5)

Re: breaking out of outer loops

2016-03-07 Thread Fillmore
On 3/7/2016 6:29 PM, Rob Gaddi wrote: You're used to Perl, you're used to exceptions being A Thing. This is Python, and exceptions are just another means of flow control. class MalformedLineError(Exception): pass for line in file: try: for part in line.split('\t'):

Re: breaking out of outer loops

2016-03-07 Thread Chris Kaynor
On Mon, Mar 7, 2016 at 3:21 PM, Fillmore wrote: > On 3/7/2016 6:17 PM, Ian Kelly wrote: > >> On Mon, Mar 7, 2016 at 4:09 PM, Fillmore >> wrote: >> >>> >>> I must be missing something simple because I can't find a way to break >>> out >>> of a nested loop in Python. >>> >>> Is there a way to labe

Re: Pyhon 2.x or 3.x, which is faster?

2016-03-07 Thread Chris Angelico
On Tue, Mar 8, 2016 at 9:39 AM, BartC wrote: > > What are you suggesting here? That all these Pythons are going to be faster > or slower than each other? I would guess that most of them are going to be > roughly the same, other than PyPy. If there was a fast version, then I would > have heard abou

Re: breaking out of outer loops

2016-03-07 Thread Rob Gaddi
Fillmore wrote: > > I must be missing something simple because I can't find a way to break > out of a nested loop in Python. > > Is there a way to label loops? > > For the record, here's a Perl script of mine I'm trying to port...there > may be 'malformed' lines in a TSV file I'm parsing that ar

Re: breaking out of outer loops

2016-03-07 Thread Fillmore
On 3/7/2016 6:17 PM, Ian Kelly wrote: On Mon, Mar 7, 2016 at 4:09 PM, Fillmore wrote: I must be missing something simple because I can't find a way to break out of a nested loop in Python. Is there a way to label loops? No, you can't break out of nested loops, wow...this is a bit of a WTF

Re: Pythonic love

2016-03-07 Thread Mark Lawrence
On 07/03/2016 22:51, Fillmore wrote: learning Python from Perl here. Want to do things as Pythonicly as possible. I am reading a TSV, but need to skip the first 5 lines. The following works, but wonder if there's a more pythonc way to do things. Thanks ctr = 0 with open(prfile,mode="rt",encodi

Re: breaking out of outer loops

2016-03-07 Thread Ian Kelly
On Mon, Mar 7, 2016 at 4:09 PM, Fillmore wrote: > > I must be missing something simple because I can't find a way to break out > of a nested loop in Python. > > Is there a way to label loops? No, you can't break out of nested loops, apart from structuring your code such that return does what you

Re: Pythonic love

2016-03-07 Thread Fillmore
On 3/7/2016 6:03 PM, sohcahto...@gmail.com wrote: On a side note, your "with open..." line uses inconsistent quoting. > You have "" on one string, but '' on another. Thanks. I'll make sure I flog myself three times later tonight... -- https://mail.python.org/mailman/listinfo/python-list

Re: Pythonic love

2016-03-07 Thread Ian Kelly
On Mon, Mar 7, 2016 at 3:51 PM, Fillmore wrote: > > learning Python from Perl here. Want to do things as Pythonicly as possible. > > I am reading a TSV, but need to skip the first 5 lines. The following works, > but wonder if there's a more pythonc way to do things. Thanks I'd probably use iterto

breaking out of outer loops

2016-03-07 Thread Fillmore
I must be missing something simple because I can't find a way to break out of a nested loop in Python. Is there a way to label loops? For the record, here's a Perl script of mine I'm trying to port...there may be 'malformed' lines in a TSV file I'm parsing that are better discarded than fix

Re: Pythonic love

2016-03-07 Thread sohcahtoa82
On Monday, March 7, 2016 at 2:51:50 PM UTC-8, Fillmore wrote: > learning Python from Perl here. Want to do things as Pythonicly as possible. > > I am reading a TSV, but need to skip the first 5 lines. The following > works, but wonder if there's a more pythonc way to do things. Thanks > > ctr =

Re: Pythonic love

2016-03-07 Thread Rob Gaddi
Fillmore wrote: > > learning Python from Perl here. Want to do things as Pythonicly as possible. > > I am reading a TSV, but need to skip the first 5 lines. The following > works, but wonder if there's a more pythonc way to do things. Thanks > > ctr = 0 > with open(prfile,mode="rt",encoding='utf-

Pythonic love

2016-03-07 Thread Fillmore
learning Python from Perl here. Want to do things as Pythonicly as possible. I am reading a TSV, but need to skip the first 5 lines. The following works, but wonder if there's a more pythonc way to do things. Thanks ctr = 0 with open(prfile,mode="rt",encoding='utf-8') as pfile: for line i

Re: Pyhon 2.x or 3.x, which is faster?

2016-03-07 Thread BartC
On 07/03/2016 20:47, Chris Angelico wrote: On Tue, Mar 8, 2016 at 7:19 AM, BartC wrote: What can be more perfect for comparing two implementations? rosuav@sikorsky:~$ python2 -m timeit -s 'from fp import Float' 'Float("1234.567")' 100 loops, best of 3: 1.84 usec per loop rosuav@sikorsk

Re: Pyhon 2.x or 3.x, which is faster?

2016-03-07 Thread Terry Reedy
On 3/7/2016 6:54 AM, Andrew Jaffe wrote: Dumb question, and this probably isn't the place for it, but the three Pythons being tested are: 64-bit CPython on Li... latest in branch '2.7' 64-bit CPython on Li... latest in branch '3.5' 64-bit CPython on Li... latest > I understand that the

Re: importing

2016-03-07 Thread Terry Reedy
On 3/7/2016 12:23 PM, Tony van der Hoff wrote: However, more generally, how am I supposed to know that a module is part of a package, and needs a "magic" stanza to get a module loaded? The doc for a package usually mentions the submodules it contains, as in https://docs.python.org/3/library/tk

Re: Struggeling with collections

2016-03-07 Thread Roel Schroeven
Faling Dutchman schreef op 2016-03-07 09:24: class Item: def __init__(self, id, productId, quantity, pageCount, files, option, metadata): self.id = id self.productId = productId self.quantity = quantity self.pageCount = pageCount self.files = files

Re: importing

2016-03-07 Thread Mark Lawrence
On 07/03/2016 20:07, MRAB wrote: On 2016-03-07 19:08, Mark Lawrence wrote: On 07/03/2016 17:38, Chris Angelico wrote: On Tue, Mar 8, 2016 at 4:23 AM, Tony van der Hoff wrote: Thanks to all who replied to my cry for help; I understand it better now. But: On 07/03/16 16:08, Chris Angelico wrot

Re: fnmatch() vs. glob.glob()

2016-03-07 Thread Ben Finney
Jinghui Niu writes: > Hi, I've been studying python 3 modules. I'm a bit confused about the > possibly overlap between fnmatch() and glob(), they seem to achieve > the same goals exactly. Why duplicate? From the module documentation: Note that unlike fnmatch.fnmatch(), glob treats filenames

Re: Pyhon 2.x or 3.x, which is faster?

2016-03-07 Thread Chris Angelico
On Tue, Mar 8, 2016 at 7:19 AM, BartC wrote: >>> I disagree. The program does its job perfectly (you will have to take it >>> further to verify the results, such as writing out the .ppm file and >>> viewing >>> the contents). >>> >>> But Py3 is slower doing this task than Py2 by 10 or 20% (or even

Re: Question

2016-03-07 Thread justin walters
Unfortunately, it's difficult for the core devs to know every hardware and os combination there is. Maybe you could submit a bug report? On Mar 7, 2016 10:56 AM, "Jon Ribbens" wrote: > On 2016-03-07, mm0fmf wrote: > > On 07/03/2016 18:09, Jon Ribbens wrote: > >> It only appears to have downloads

Re: Pyhon 2.x or 3.x, which is faster?

2016-03-07 Thread BartC
On 07/03/2016 19:10, Chris Angelico wrote: On Tue, Mar 8, 2016 at 5:34 AM, BartC wrote: def abortjpeg(mess): print ("Error:",mess) raise Here's my Python: RuntimeError: No active exception to reraise OK I'll have a look. (Or maybe just change 'raise' to 'exit(0)'. It just nee

fnmatch() vs. glob.glob()

2016-03-07 Thread Jinghui Niu
Hi, I've been studying python 3 modules. I'm a bit confused about the possibly overlap between fnmatch() and glob(), they seem to achieve the same goals exactly. Why duplicate? Or maybe something I've missed? Thank you. -- https://mail.python.org/mailman/listinfo/python-list

Re: importing

2016-03-07 Thread MRAB
On 2016-03-07 19:08, Mark Lawrence wrote: On 07/03/2016 17:38, Chris Angelico wrote: On Tue, Mar 8, 2016 at 4:23 AM, Tony van der Hoff wrote: Thanks to all who replied to my cry for help; I understand it better now. But: On 07/03/16 16:08, Chris Angelico wrote: The documentation should tel

Re: Question

2016-03-07 Thread Andrew Farrell
I'm going to echo Chris Angelo's suggestion #2 to use a python distribution. This page has the links to download Anaconda. It is free and if you need to download libraries which require compiled external code like numpy you can just run `conda install numpy`. O

Re: Question

2016-03-07 Thread Chris Angelico
On Tue, Mar 8, 2016 at 5:51 AM, Jon Ribbens wrote: > I must say that Python on Windows was a very poor experience indeed, > "virtualenv" does not work and "venv" refuses to create the 'activate' > shell script so does not work either (and pygame doesn't work, but > that's presumably not Python's f

Re: Question

2016-03-07 Thread Ian Kelly
On Mon, Mar 7, 2016 at 11:51 AM, Jon Ribbens wrote: > I must say that Python on Windows was a very poor experience indeed, > "virtualenv" does not work and "venv" refuses to create the 'activate' > shell script so does not work either I've used both of these on Windows (although not recently) and

Re: Pyhon 2.x or 3.x, which is faster?

2016-03-07 Thread Chris Angelico
On Tue, Mar 8, 2016 at 5:34 AM, BartC wrote: > On 07/03/2016 15:31, Chris Angelico wrote: >> >> On Tue, Mar 8, 2016 at 12:25 AM, BartC wrote: > > >>> (The Python version of that program is here: >>> http://pastebin.com/cHx3UhQb. It should work with any Python.) >> >> >> Actually, it won't work wi

Re: importing

2016-03-07 Thread Mark Lawrence
On 07/03/2016 17:38, Chris Angelico wrote: On Tue, Mar 8, 2016 at 4:23 AM, Tony van der Hoff wrote: Thanks to all who replied to my cry for help; I understand it better now. But: On 07/03/16 16:08, Chris Angelico wrote: The documentation should tell you what you need to import to make somet

Re: Pyhon 2.x or 3.x, which is faster?

2016-03-07 Thread Mark Lawrence
On 07/03/2016 11:02, BartC wrote: PyPy I think is only compatible with Python 3 code (there are a few other issues too). Quoting from http://doc.pypy.org/en/latest/release-0.7.0.html "The interpreter and object model implementations shipped with the 0.7 version can run on their own and impl

Re: Question

2016-03-07 Thread Jon Ribbens
On 2016-03-07, mm0fmf wrote: > On 07/03/2016 18:09, Jon Ribbens wrote: >> It only appears to have downloads for 32-bit, or 64-bit AMD processors, >> not 64-bit Intel processors. > > You didn't read the bit that says > > "The binaries for AMD64 will also work on processors that implement the > Int

Re: Pyhon 2.x or 3.x, which is faster?

2016-03-07 Thread BartC
On 07/03/2016 15:31, Chris Angelico wrote: On Tue, Mar 8, 2016 at 12:25 AM, BartC wrote: (The Python version of that program is here: http://pastebin.com/cHx3UhQb. It should work with any Python.) Actually, it won't work with any Python - not if it gets a broken file. Your abortjpeg() funct

Re: Question

2016-03-07 Thread Random832
On Mon, Mar 7, 2016, at 13:09, Jon Ribbens wrote: > It only appears to have downloads for 32-bit, or 64-bit AMD processors, > not 64-bit Intel processors. Current 64-bit processors produced by Intel use the "AMD64" architecture, not the Intel IA-64 (Itanium) architecture. -- https://mail.python.o

Re: Question

2016-03-07 Thread Chris Warrick
On 7 March 2016 at 19:09, Jon Ribbens wrote: > On 2016-03-07, Ian Kelly wrote: >> On Mon, Mar 7, 2016 at 9:39 AM, Ben Morales wrote: >>> I am trying to download Python but I have windows 10 and I do not see a 64 >>> bit download for my operating system. Do you have a 64 bit for windows? >> >> Wh

Re: Question

2016-03-07 Thread mm0fmf
On 07/03/2016 18:09, Jon Ribbens wrote: On 2016-03-07, Ian Kelly wrote: On Mon, Mar 7, 2016 at 9:39 AM, Ben Morales wrote: I am trying to download Python but I have windows 10 and I do not see a 64 bit download for my operating system. Do you have a 64 bit for windows? What page are you loo

Re: Question

2016-03-07 Thread Mark Lawrence
On 07/03/2016 17:42, Ian Kelly wrote: On Mon, Mar 7, 2016 at 10:25 AM, Mark Lawrence wrote: On 07/03/2016 16:57, Ian Kelly wrote: On Mon, Mar 7, 2016 at 9:39 AM, Ben Morales wrote: I am trying to download Python but I have windows 10 and I do not see a 64 bit download for my operating syst

Re: Question

2016-03-07 Thread Jon Ribbens
On 2016-03-07, Ian Kelly wrote: > On Mon, Mar 7, 2016 at 10:25 AM, Mark Lawrence > wrote: >> I've been running 64 bit Python on Windows for years with no problems. Why >> use 32 bit? I certainly don't understand why you'd need to. > > It seems to be easier to find 32-bit binaries for libraries.

Re: Question

2016-03-07 Thread Jon Ribbens
On 2016-03-07, Ian Kelly wrote: > On Mon, Mar 7, 2016 at 9:39 AM, Ben Morales wrote: >> I am trying to download Python but I have windows 10 and I do not see a 64 >> bit download for my operating system. Do you have a 64 bit for windows? > > What page are you looking at? > https://www.python.org/

Re: Question

2016-03-07 Thread Ian Kelly
On Mon, Mar 7, 2016 at 10:25 AM, Mark Lawrence wrote: > On 07/03/2016 16:57, Ian Kelly wrote: >> >> On Mon, Mar 7, 2016 at 9:39 AM, Ben Morales >> wrote: >>> >>> I am trying to download Python but I have windows 10 and I do not see a >>> 64 >>> bit download for my operating system. Do you have a

Re: importing

2016-03-07 Thread Ian Kelly
On Mon, Mar 7, 2016 at 10:23 AM, Tony van der Hoff wrote: > However, more generally, how am I supposed to know that a module is part of > a package, and needs a "magic" stanza to get a module loaded? If the import path of the module has a dot in it, then it's part of a package. -- https://mail.p

Re: importing

2016-03-07 Thread Chris Angelico
On Tue, Mar 8, 2016 at 4:23 AM, Tony van der Hoff wrote: > Thanks to all who replied to my cry for help; I understand it better now. > But: > > On 07/03/16 16:08, Chris Angelico wrote: >> >> >> The documentation should tell you what you need to import to make >> something work. In this case, I wou

Re: importing

2016-03-07 Thread Mark Lawrence
On 07/03/2016 17:23, Tony van der Hoff wrote: Thanks to all who replied to my cry for help; I understand it better now. But: On 07/03/16 16:08, Chris Angelico wrote: The documentation should tell you what you need to import to make something work. In this case, I would guess that "import tkint

Re: How to get which attribute causes the AttributeError except inspecting strings?

2016-03-07 Thread Mark Lawrence
On 07/03/2016 16:38, Tim Golden wrote: On 07/03/2016 16:25, Xiang Zhang wrote: Hi, I know I can get the attribute name in some way, but since I just want the attribute name when an AttributeError caused by it raised, I really don't want to inspect the string or introduce one more layer over get

Re: Question

2016-03-07 Thread Mark Lawrence
On 07/03/2016 16:57, Ian Kelly wrote: On Mon, Mar 7, 2016 at 9:39 AM, Ben Morales wrote: I am trying to download Python but I have windows 10 and I do not see a 64 bit download for my operating system. Do you have a 64 bit for windows? What page are you looking at? https://www.python.org/down

Re: importing

2016-03-07 Thread Tony van der Hoff
Thanks to all who replied to my cry for help; I understand it better now. But: On 07/03/16 16:08, Chris Angelico wrote: The documentation should tell you what you need to import to make something work. In this case, I would guess that "import tkinter.messagebox" or "from tkinter import message

Re: How to get which attribute causes the AttributeError except inspecting strings?

2016-03-07 Thread Xiang Zhang
On Tuesday, March 8, 2016 at 12:38:31 AM UTC+8, Tim Golden wrote: > On 07/03/2016 16:25, Xiang Zhang wrote: > > Hi, > > > > I know I can get the attribute name in some way, but since I just > > want the attribute name when an AttributeError caused by it raised, I > > really don't want to inspect t

Re: Question

2016-03-07 Thread Ian Kelly
On Mon, Mar 7, 2016 at 9:39 AM, Ben Morales wrote: > I am trying to download Python but I have windows 10 and I do not see a 64 > bit download for my operating system. Do you have a 64 bit for windows? What page are you looking at? https://www.python.org/downloads/release/python-351/ has download

Question

2016-03-07 Thread Ben Morales
I am trying to download Python but I have windows 10 and I do not see a 64 bit download for my operating system. Do you have a 64 bit for windows? Sincerely, *Ben Morales* -- https://mail.python.org/mailman/listinfo/python-list

Re: A mistake which almost went me mad

2016-03-07 Thread Chris Angelico
On Tue, Mar 8, 2016 at 3:19 AM, Ian Kelly wrote: > On Thu, Mar 3, 2016 at 11:50 AM, Tim Chase > wrote: >> I think that relative imports should ameliorate this, as I usually >> hit it when I'm using smtplib which in turn imports "email" (and, in >> 2.x when it found my local email.py would crash a

Re: How to get which attribute causes the AttributeError except inspecting strings?

2016-03-07 Thread Tim Golden
On 07/03/2016 16:25, Xiang Zhang wrote: > Hi, > > I know I can get the attribute name in some way, but since I just > want the attribute name when an AttributeError caused by it raised, I > really don't want to inspect the string or introduce one more layer > over getattr. I hope I can get the att

Re: How to get which attribute causes the AttributeError except inspecting strings?

2016-03-07 Thread Xiang Zhang
Hi, I know I can get the attribute name in some way, but since I just want the attribute name when an AttributeError caused by it raised, I really don't want to inspect the string or introduce one more layer over getattr. I hope I can get the attribute which causes the exception from the Attrib

  1   2   >