Re: Reason for not allowing import twice but allowing reload()

2016-03-06 Thread alien2utoo
Based on the input from members, and my subsequent reading the textbook/tutorials, let me summarize my understanding of "why subsequent imports of same module are designed to be effect-less". 1. Imports are costly affair, as it involves - finding the module's file - compile it to byte code (if

Re: Reason for not allowing import twice but allowing reload()

2016-03-06 Thread alien2utoo
>From the discussions in this thread, I get the impression that there are >genuine requirements to reload() a module during a program's execution. It is fairly easy to see reload() in context of interactive execution, but how does it come into picture in case of non-interactive Python program ex

Re: Adding Icon To Tkinter Window - Followup

2016-03-06 Thread Christian Gollwitzer
Am 06.03.16 um 06:53 schrieb Wildman: On Sat, 05 Mar 2016 19:36:19 +0100, Christian Gollwitzer wrote: import Tkinter from Tkinter import Tk root = Tk() img = Tkinter.Image("photo", file="appicon.gif") root.call('wm','iconphoto',root._w,img) The above worked perfectly. Thank you very much. T

Re: Application console for Tkinter program?

2016-03-06 Thread Christian Gollwitzer
Am 05.03.16 um 22:16 schrieb Terry Reedy: Not now. A console is a REPL + text display to read from and print to. The actual IDLE REPL is PyShell.ModifiedInterpreter, which subclasses stdlib code.InteractiveInterpreter. Most of the additions are for interacting with the subprocess that runs user

Compact connected regular graphs

2016-03-06 Thread jonas . thornvall
How come all graphs using 42 links and more then 84 nodes have compact regular connected solutions? Did turn off animation for more than a couple of thousands of links so the animation is off when searching but script give message and numerical results on search. http://jt.node365.se/nodes15

Re: Compact connected regular graphs

2016-03-06 Thread Mark Lawrence
On 06/03/2016 10:39, jonas.thornv...@gmail.com wrote: How come all graphs using 42 links and more then 84 nodes have compact regular connected solutions? Did turn off animation for more than a couple of thousands of links so the animation is off when searching but script give message and num

Re: Compact connected regular graphs

2016-03-06 Thread jonas . thornvall
Den söndag 6 mars 2016 kl. 12:01:02 UTC+1 skrev Mark Lawrence: > On 06/03/2016 10:39, jonas.thornv...@gmail.com wrote: > > How come all graphs using 42 links and more then 84 nodes have compact > > regular connected solutions? > > > > Did turn off animation for more than a couple of thousands of

Re: Compact connected regular graphs

2016-03-06 Thread Mark Lawrence
On 06/03/2016 11:04, jonas.thornv...@gmail.com wrote: Den söndag 6 mars 2016 kl. 12:01:02 UTC+1 skrev Mark Lawrence: On 06/03/2016 10:39, jonas.thornv...@gmail.com wrote: How come all graphs using 42 links and more then 84 nodes have compact regular connected solutions? Did turn off animatio

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

2016-03-06 Thread Tony van der Hoff
Hi, I've been experimenting with a short test program under python 2.7 and python 3.4.2. It's a simple read from file, and locate a word therein. I get the (subjective) impression that python2 is slightly faster than python3. Is that correct? Is there any documentation to support this? Thank

Re: Application console for Tkinter program?

2016-03-06 Thread Terry Reedy
On 3/6/2016 4:23 AM, Christian Gollwitzer wrote: Am 05.03.16 um 22:16 schrieb Terry Reedy: Not now. A console is a REPL + text display to read from and print to. The actual IDLE REPL is PyShell.ModifiedInterpreter, which subclasses stdlib code.InteractiveInterpreter. Most of the additions are f

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

2016-03-06 Thread Terry Reedy
On 3/6/2016 6:34 AM, Tony van der Hoff wrote: Hi, I've been experimenting with a short test program under python 2.7 and python 3.4.2. It's a simple read from file, and locate a word therein. I get the (subjective) impression that python2 is slightly faster than python3. Is that correct? Is the

IDLE question: "you may still have to reload nested modules."

2016-03-06 Thread alien2utoo
Hello list, I am following "Learning Python: Mark Lutz" and came across following in chapter 3 few days back. [quote] * You may still have to reload nested modules. Technically speaking, IDLE's Run->Run Module menu option always runs the current version of the top-level file only; imported

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

2016-03-06 Thread Peter Otten
Tony van der Hoff wrote: > Hi, I've been experimenting with a short test program under python 2.7 > and python 3.4.2. Ideally you would provide the source. > It's a simple read from file, and locate a word therein. Do both runs operate on the same kind of string (either bytestring or unicode)

even faster heaps

2016-03-06 Thread Sven R. Kunze
Hi python-list, hi Srinivas, I managed to implement the mark&sweep approach for fast removal from heaps. This way, I got three pleasant results: 1) a substantial speed up! 2) an improved testsuite 3) discovery and fixing of several bugs @Srinivas I would be honored if you could have a look at

Re: Photon mass (was: [Still off-top] Physics)

2016-03-06 Thread Gene Heskett
On Saturday 05 March 2016 10:46:04 Thomas 'PointedEars' Lahn wrote: > Gene Heskett wrote: > > I've never heard of a massless photon, > > That is unfortunate as it should be common knowledge by now. > > > and they do exert a push on the surface they are reflected from, […] > > Photons exert a force

Phyton

2016-03-06 Thread Diego ...
Hello! I have a question in an exercise that says : Write an expression to determine whether a person should or should not pay tax . Consider paying tax people whose salary is greater than R $ 1,200.00 I do not know how to mount the logical expression !!! It's like: salary = 1250 tax = Not Tru

???

2016-03-06 Thread kyleolson1988
I cant figure out how to get to the program so I can write code. started and introductory programming class for college and im unable to figure out how to open this program on my computer. please help if you can, your time would be much appreciate. Sent from Windows Mail -- https://mail.p

Python 3.5.1 (32-bit)_20160306131105

2016-03-06 Thread ????
when I am installing Python 3.5.1 (32-bit)??some problems occurred.I hope you could offer me some help.This file may contain some information about the error. -- https://mail.python.org/mailman/listinfo/python-list

Regarding installation of python-3.5.1

2016-03-06 Thread Roshan S Sontakke
Gud afternoon sir my self Roshan sontakke I have down loaded a setup of python-3.5.1 but nt able to install it gives an error message -- https://mail.python.org/mailman/listinfo/python-list

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

2016-03-06 Thread Steven D'Aprano
On Sun, 6 Mar 2016 10:34 pm, Tony van der Hoff wrote: > Hi, I've been experimenting with a short test program under python 2.7 > and python 3.4.2. It's a simple read from file, and locate a word therein. > > I get the (subjective) impression that python2 is slightly faster than > python3. Is tha

Re: password and username code

2016-03-06 Thread John Gordon
In <1ed89545-f102-4538-bfe2-9d0e3dac8...@googlegroups.com> =?UTF-8?B?w5ZtZXIgc2FyxLE=?= writes: > l want program if username is not registered, register first, > then store it, and l want program ask for some specific characters, > like 1,2,3../,%. What is your process for finding out if a nam

Re: Python 3.5.1 (32-bit)_20160306131105

2016-03-06 Thread Steven D'Aprano
On Sun, 6 Mar 2016 04:32 pm, 程仿 wrote: > when I am installing Python 3.5.1 (32-bit),some problems occurred.I hope > you could offer me some help.This file may contain some information about > the error. What file? Please COPY AND PASTE the text of the error message into your email. -- Steven

Re: Reason for not allowing import twice but allowing reload()

2016-03-06 Thread Steven D'Aprano
On Sun, 6 Mar 2016 07:20 pm, alien2u...@gmail.com wrote: > Based on the input from members, and my subsequent reading the > textbook/tutorials, let me summarize my understanding of "why subsequent > imports of same module are designed to be effect-less". That is not correct. Imports are not a no-

Re: Regarding installation of python-3.5.1

2016-03-06 Thread Steven D'Aprano
On Sun, 6 Mar 2016 05:35 pm, Roshan S Sontakke wrote: > Gud afternoon sir my self Roshan sontakke I have down loaded a setup of > python-3.5.1 but nt able to install it gives an error message Shall we guess what the error message says, or would you like to tell us? -- Steven -- https://mail

Re: password and username code

2016-03-06 Thread Ömer sarı
5 Mart 2016 Cumartesi 23:52:58 UTC+2 tarihinde Ömer sarı yazdı: > hi , all , l m fresh user and l m trying to learn python by doing practice > but l got stuck in that , l need help , l m a beginner and l learn some > basic things so far so, plz take in consideration that before command . > > he

Re: Phyton

2016-03-06 Thread marco . nawijn
On Sunday, March 6, 2016 at 3:16:19 PM UTC+1, Diego ... wrote: > Hello! I have a question in an exercise that says : Write an expression to > determine whether a person should or should not pay tax . Consider paying tax > people whose salary is greater than R $ 1,200.00 > > I do not know how to

Re: Phyton

2016-03-06 Thread BartC
On 06/03/2016 15:28, marco.naw...@colosso.nl wrote: On Sunday, March 6, 2016 at 3:16:19 PM UTC+1, Diego ... wrote: Hello! I have a question in an exercise that says : Write an expression to determine whether a person should or should not pay tax . Consider paying tax people whose salary is gre

Re: SQLite

2016-03-06 Thread Klaus Jantzen
On 02/22/2016 09:32 AM, Klaus Jantzen wrote: On 02/21/2016 10:37 PM, Albert-Jan Roskam wrote: (Sorry for top posting) IIRC, you have to do sudo apt-get install build-essential python-dev ... then re-compile python > To: [[1]1]python-list@python.org > F

Re: Adding Icon To Tkinter Window - Followup

2016-03-06 Thread Wildman via Python-list
On Sun, 06 Mar 2016 10:16:55 +0100, Christian Gollwitzer wrote: > Am 06.03.16 um 06:53 schrieb Wildman: >> On Sat, 05 Mar 2016 19:36:19 +0100, Christian Gollwitzer wrote: >>> import Tkinter >>> from Tkinter import Tk >>> root = Tk() >>> img = Tkinter.Image("photo", file="appicon.gif") >>> root.cal

Re: Regarding installation of python-3.5.1

2016-03-06 Thread Grant Edwards
On 2016-03-06, Steven D'Aprano wrote: > On Sun, 6 Mar 2016 05:35 pm, Roshan S Sontakke wrote: > >> Gud afternoon sir my self Roshan sontakke I have down loaded a setup of >> python-3.5.1 but nt able to install it gives an error message > > Shall we guess what the error message says, or would you l

Re: ???

2016-03-06 Thread Mark Lawrence
On 04/03/2016 23:26, kyleolson1...@gmail.com wrote: I cant figure out how to get to the program so I can write code. started and introductory programming class for college and im unable to figure out how to open this program on my computer. please help if you can, your time would be much appre

Re: Python 3.5.1 (32-bit)_20160306131105

2016-03-06 Thread Mark Lawrence
On 06/03/2016 05:32, wrote: when I am installing Python 3.5.1 (32-bit)??some problems occurred.I hope you could offer me some help.This file may contain some information about the error. This type of question has been asked and answered repeatedly over the last few months, so please sea

Re: Regarding installation of python-3.5.1

2016-03-06 Thread Mark Lawrence
On 06/03/2016 06:35, Roshan S Sontakke wrote: Gud afternoon sir my self Roshan sontakke I have down loaded a setup of python-3.5.1 but nt able to install it gives an error message Please read this http://www.catb.org/esr/faqs/smart-questions.html and then have a go at providing us with the d

Re: Phyton

2016-03-06 Thread Mark Lawrence
On 05/03/2016 15:41, Diego ... wrote: Hello! I have a question in an exercise that says : Write an expression to determine whether a person should or should not pay tax . Consider paying tax people whose salary is greater than R $ 1,200.00 I do not know how to mount the logical expression !!!

Re: Phyton

2016-03-06 Thread Mark Lawrence
On 06/03/2016 15:28, marco.naw...@colosso.nl wrote: On Sunday, March 6, 2016 at 3:16:19 PM UTC+1, Diego ... wrote: Hello! I have a question in an exercise that says : Write an expression to determine whether a person should or should not pay tax . Consider paying tax people whose salary is gre

Re: Phyton

2016-03-06 Thread Ian Kelly
On Sun, Mar 6, 2016 at 10:05 AM, Mark Lawrence wrote: > Why in the year 2016 are people still giving links to the Luddite Python 2 > docs? Maybe because it's the version that comes up when googling for "python if statement". -- https://mail.python.org/mailman/listinfo/python-list

reversed(zip(...)) not working as intended

2016-03-06 Thread Sven R. Kunze
Hi, what's the reason that reversed(zip(...)) raises as a TypeError? Would allowing reversed to handle zip and related functions lead to strange errors? Best, Sven -- https://mail.python.org/mailman/listinfo/python-list

Re: reversed(zip(...)) not working as intended

2016-03-06 Thread Tim Chase
On 2016-03-06 19:29, Sven R. Kunze wrote: > what's the reason that reversed(zip(...)) raises as a TypeError? > > Would allowing reversed to handle zip and related functions lead to > strange errors? Peculiar, as this works in 2.x but falls over in 3.x: $ python Python 2.7.9 (default, Mar 1 201

RE: reversed(zip(...)) not working as intended

2016-03-06 Thread Albert-Jan Roskam
(Sorry for top-posting) No TypeError here: Python 2.7.2 (default, Nov 2 2015, 01:07:37) [GCC 4.9 20140827 (prerelease)] on linux4 Type "help", "copyright", "credits" or "license" for more information. >>> ten = range(10) >>> reversed(zip(ten, ten)) >>> list(reversed(zip(ten, ten))) [(9, 9), (

Re: reversed(zip(...)) not working as intended

2016-03-06 Thread Peter Otten
Sven R. Kunze wrote: > what's the reason that reversed(zip(...)) raises as a TypeError? > > Would allowing reversed to handle zip and related functions lead to > strange errors? In Python 3 zip() can deal with infinite iterables -- what would you expect from reversed(zip(count())) ? If all

Re: reversed(zip(...)) not working as intended

2016-03-06 Thread Tim Chase
On 2016-03-06 12:38, Tim Chase wrote: > On 2016-03-06 19:29, Sven R. Kunze wrote: > > what's the reason that reversed(zip(...)) raises as a TypeError? > > I'm not sure why reversed() doesn't think that the thing returned by > zip() isn't a sequence. Ah, a little more digging suggests that in 2.x,

Re: reversed(zip(...)) not working as intended

2016-03-06 Thread Peter Otten
Tim Chase wrote: > On 2016-03-06 19:29, Sven R. Kunze wrote: >> what's the reason that reversed(zip(...)) raises as a TypeError? >> >> Would allowing reversed to handle zip and related functions lead to >> strange errors? > > Peculiar, as this works in 2.x but falls over in 3.x: > > $ python >

Re: reversed(zip(...)) not working as intended

2016-03-06 Thread MRAB
On 2016-03-06 18:29, Sven R. Kunze wrote: Hi, what's the reason that reversed(zip(...)) raises as a TypeError? Would allowing reversed to handle zip and related functions lead to strange errors? 'reversed' yields the items in reverse order; it needs the last item first. Iterators yield items

Re: Phyton

2016-03-06 Thread Mark Lawrence
On 06/03/2016 17:20, Ian Kelly wrote: On Sun, Mar 6, 2016 at 10:05 AM, Mark Lawrence wrote: Why in the year 2016 are people still giving links to the Luddite Python 2 docs? Maybe because it's the version that comes up when googling for "python if statement". The obvious solution is to take

Re: reversed(zip(...)) not working as intended

2016-03-06 Thread Sven R. Kunze
On 06.03.2016 19:53, Peter Otten wrote: Sven R. Kunze wrote: what's the reason that reversed(zip(...)) raises as a TypeError? Would allowing reversed to handle zip and related functions lead to strange errors? In Python 3 zip() can deal with infinite iterables -- what would you expect from r

Re: reversed(zip(...)) not working as intended

2016-03-06 Thread Sven R. Kunze
On 06.03.2016 19:51, Tim Chase wrote: So it looks like one needs to either results = reversed(list(zip(...))) or, more efficiently (doing it with one less duplication of the list) results = list(zip(...)) results.reverse() Nice idea. :) Unfortunately, I used it while drafting som

Re: IDLE question: "you may still have to reload nested modules."

2016-03-06 Thread Terry Reedy
On 3/6/2016 7:24 AM, alien2u...@gmail.com wrote: Hello list, I am following "Learning Python: Mark Lutz" and came across following in chapter 3 few days back. What is the copyright date on the copy you have? [quote] * You may still have to reload nested modules. Technically speaking, IDLE's

Re: Photon mass (was: [Still off-top] Physics)

2016-03-06 Thread Larry Martell
On Sat, Mar 5, 2016 at 12:36 PM, Gene Heskett wrote: > On Saturday 05 March 2016 10:46:04 Thomas 'PointedEars' Lahn wrote: > >> Gene Heskett wrote: >> > I've never heard of a massless photon, >> >> That is unfortunate as it should be common knowledge by now. >> >> > and they do exert a push on the

Re: Photon mass (was: [Still off-top] Physics)

2016-03-06 Thread Gene Heskett
On Sunday 06 March 2016 09:21:49 Larry Martell wrote: > On Sat, Mar 5, 2016 at 12:36 PM, Gene Heskett wrote: [...] > > So in that scenario, I have first hand knowledge about relativity > > despite my offical 8th grade education. > > Gene, your massive and varied experiences trump my formal edu

Re: Photon mass (was: [Still off-top] Physics)

2016-03-06 Thread Larry Martell
On Sun, Mar 6, 2016 at 4:46 PM, Gene Heskett wrote: > > Has Carol written anything new lately? I replied to Gene privately, but if anyone is wondering, Carol is my wife and these are her blogs: Non-fiction: http://minervaontheroad.com/ Fiction: https://minervamartell.wordpress.com/ -- https:

Re: Phyton

2016-03-06 Thread Steven D'Aprano
On Mon, 7 Mar 2016 04:05 am, Mark Lawrence wrote: > Why in the year 2016 are people still giving links to the Luddite Python > 2 docs? Because Python 2.7 is still supported, and will be officially supported until 2020, after which it will still have third-party support from companies like Red Hat

Re: Phyton

2016-03-06 Thread Larry Martell
On Sun, Mar 6, 2016 at 6:14 PM, Steven D'Aprano wrote: > On Mon, 7 Mar 2016 04:05 am, Mark Lawrence wrote: > >> Why in the year 2016 are people still giving links to the Luddite Python >> 2 docs? > > Because Python 2.7 is still supported, and will be officially supported > until 2020, after which

Re: Phyton

2016-03-06 Thread Chris Angelico
On Mon, Mar 7, 2016 at 10:14 AM, Steven D'Aprano wrote: > And I take exception to your use of the word "Luddite" to describe Python 2. > Python 2 is a perfectly fine programming language, and it will continue to > be used by some well past 2020. There's no need to bully people into > upgrading to

Re: Any comment on using ctypesgen package?

2016-03-06 Thread jfong
Mark Lawrence at 2016/3/5 UTC+8 8:01:06PM wrote: > > HTH http://python3porting.com/problems.html OK, now I understand what "from .cparset import *" means, but it didn't help on solving this import error:-( Thanks for the link, although it seems not help on this problem either:-) --Jach -- h

__del__: when to use it? What happens when you SystemExit/NameError wrt del? Method vs function calls.

2016-03-06 Thread Veek. M
1. What are the rules for using __del__ besides: 'don't use it'. 2. What happens when I SystemExit? __del__ and gc are not invoked when I SystemExit and there's a circular reference - but why? The OS is going to reclaim the memory anyways so why be finicky about circular references - why can't

Re: __del__: when to use it? What happens when you SystemExit/NameError wrt del? Method vs function calls.

2016-03-06 Thread Chris Angelico
On Mon, Mar 7, 2016 at 2:27 PM, Veek. M wrote: > 1. What are the rules for using __del__ besides: 'don't use it'. Use it as a last-shot cleanup of resources you own. Don't depend on it, but use it. > 2. What happens when I SystemExit? __del__ and gc are not invoked when I > SystemExit and there'

Re: __del__: when to use it? What happens when you SystemExit/NameError wrt del? Method vs function calls.

2016-03-06 Thread Ben Finney
"Veek. M" writes: > 1. What are the rules for using __del__ besides: 'don't use it'. What do you mean by “rules”? If you want advice on using that method, I don't think a canonical exhaustive “rules” set exists. For example: Use ‘__del__’ to mark an object as no longer used; don't expect that

Regex: Perl to Python

2016-03-06 Thread Fillmore
Hi, I'm trying to move away from Perl and go to Python. Regex seems to bethe hardest challenge so far. Perl: while () { if (/(\d+)\t(.+)$/) { print $1." - ". $2."\n"; } } into python pattern = re.compile(r"(\d+)\t(.+)$") with open(fields_Indexfile,mode="rt",encoding='utf-8') a

Re: Regex: Perl to Python

2016-03-06 Thread Chris Angelico
On Mon, Mar 7, 2016 at 3:38 PM, Fillmore wrote: > pattern = re.compile(r"(\d+)\t(.+)$") > with open(fields_Indexfile,mode="rt",encoding='utf-8') as headerfile: > for line in headerfile: > #sys.stdout.write(line) > m = pattern.match(line) > print(m.group(0)) > header

Re: Regex: Perl to Python

2016-03-06 Thread Terry Reedy
On 3/6/2016 11:38 PM, Fillmore wrote: Hi, I'm trying to move away from Perl and go to Python. Regex seems to bethe hardest challenge so far. Perl: while () { if (/(\d+)\t(.+)$/) { print $1." - ". $2."\n"; } } into python pattern = re.compile(r"(\d+)\t(.+)$") with open(fields_I

Re: Regex: Perl to Python

2016-03-06 Thread Rustom Mody
Also for regex hacking: Try with findall before using match/search -- https://mail.python.org/mailman/listinfo/python-list

Re: Regex: Perl to Python

2016-03-06 Thread Rustom Mody
Also for regex hacking: Try with findall before using match/search -- https://mail.python.org/mailman/listinfo/python-list

Re: __del__: when to use it? What happens when you SystemExit/NameError wrt del? Method vs function calls.

2016-03-06 Thread Steven D'Aprano
On Monday 07 March 2016 14:27, Veek. M wrote: > 1. What are the rules for using __del__ besides: 'don't use it'. __del__ needs to be defined in a class to be called. It will be called *at some point* when the instance is about to be garbage collected. There is no guarantee when that will be: it

Re: __del__: when to use it? What happens when you SystemExit/NameError wrt del? Method vs function calls.

2016-03-06 Thread Veek. M
Veek. M wrote: > 1. What are the rules for using __del__ besides: 'don't use it'. > > 2. What happens when I SystemExit? __del__ and gc are not invoked when > I SystemExit and there's a circular reference - but why? The OS is > going to reclaim the memory anyways so why be finicky about circular

Re: Phyton

2016-03-06 Thread marco . nawijn
On Sunday, March 6, 2016 at 6:10:22 PM UTC+1, Mark Lawrence wrote: > On 06/03/2016 15:28, marco.naw...@colosso.nl wrote: > > On Sunday, March 6, 2016 at 3:16:19 PM UTC+1, Diego ... wrote: > >> Hello! I have a question in an exercise that says : Write an expression to > >> determine whether a perso

Re: Regex: Perl to Python

2016-03-06 Thread Peter Otten
Fillmore wrote: > > Hi, I'm trying to move away from Perl and go to Python. > Regex seems to bethe hardest challenge so far. > > Perl: > > while () { > if (/(\d+)\t(.+)$/) { > print $1." - ". $2."\n"; > } > } > > into python > > pattern = re.compile(r"(\d+)\t(.+)$") > with open(fiel

Re: Phyton

2016-03-06 Thread Chris Angelico
On Mon, Mar 7, 2016 at 5:45 PM, wrote: > As a side note, you are probably aware that if you look at the Linux > ecosystems there are still a lot of distributions that have Python 2 > as a default. There are still also large mainstream libraries that > do not (or just very recently) have support f