Re: SQLite3 in Python 2.7 Rejecting Foreign Key Insert

2014-11-23 Thread Frank Millman
"Chris Angelico" wrote in message news:captjjmp4y5zowwn5yftjutko4h5jvtqlantwqepa6b35xnd...@mail.gmail.com... > > Entirely possible. I never did track down the actual cause of the > SQLite3 issues my students were having; though I suspect it's not > purely a Python API issue. I tried to demonstra

Re: SQLite3 in Python 2.7 Rejecting Foreign Key Insert

2014-11-23 Thread Chris Angelico
On Sun, Nov 23, 2014 at 7:21 PM, Frank Millman wrote: > "Chris Angelico" wrote in message > news:captjjmp4y5zowwn5yftjutko4h5jvtqlantwqepa6b35xnd...@mail.gmail.com... >> >> Entirely possible. I never did track down the actual cause of the >> SQLite3 issues my students were having; though I suspec

Embedded python 'scripting engine' inside Python app

2014-11-23 Thread Patrick Stinson
I am writing a python app (using PyQt, but that’s not important here), and want my users to be able to write their own scripts to automate the app’s functioning using an engine API hat I expose. I have extensive experience doing this in a C++ app with the CPython api, but have no idea how to do

Re: Python IDE.

2014-11-23 Thread Ricardo Aráoz
Spyder El 20/11/14 a las 18:47, TP escibió: On Thu, Nov 20, 2014 at 11:29 AM, Irmen de Jong mailto:irmen.nos...@xs4all.nl>> wrote: PyCharm *is* free, if you fall in one of several categories. See http://www.jetbrains.com/pycharm/buy/license-matrix.jsp Even when you have to buy it

unloading a module created with imp.new_module

2014-11-23 Thread Patrick Stinson
If I create a module with imp.new_module(name), how can I unload it so that all the references contained in it are set to zero and the module is deleted? deleting the reference that is returned doesn’t seem to do the job, and it’s not in sys.modules, so where is the dangling reference? Thanks!

Re: Challenge: optimizing isqrt

2014-11-23 Thread Stephen Tucker
Serhiy, This looks very good indeed. As a matter of interest, is there any particular reason you have used 2*b instead of b+b? Might b+b be faster than b*2? Also, in various lines, you use //2. Would >>1 be quicker? On reflection, perhaps you have had to use //2 because >>1 cannot be used in thos

Re: Embedded python 'scripting engine' inside Python app

2014-11-23 Thread Chris Angelico
On Sun, Nov 23, 2014 at 4:48 PM, Patrick Stinson wrote: > I am writing a python app (using PyQt, but that’s not important here), and > want my users to be able to write their own scripts to automate the app’s > functioning using an engine API hat I expose. I have extensive experience > doing th

Re: SQLite3 in Python 2.7 Rejecting Foreign Key Insert

2014-11-23 Thread Jussi Piitulainen
Chris Angelico writes: > On Sun, Nov 23, 2014 at 7:21 PM, Frank Millman wrote: > > > To enable them, add the following - > > > > pragma foreign_keys = on; > > > > It works for me. > > Thanks, I went poking around briefly but didn't find that pragma. I didn't notice a pointer to the relevant docum

Re: unloading a module created with imp.new_module

2014-11-23 Thread Ian Kelly
On Sat, Nov 22, 2014 at 11:49 PM, Patrick Stinson wrote: > If I create a module with imp.new_module(name), how can I unload it so that > all the references contained in it are set to zero and the module is deleted? > deleting the reference that is returned doesn’t seem to do the job, and it’s >

[ANN] Pylint 1.4 released

2014-11-23 Thread Claudiu Popa
Hello! On behalf of the Pylint development team, I'm happy to announce that Pylint 1.4 has been released. This release has a lot of improvements over the last one. One of the main differences is that support for Python versions < 2.7 has been droped, which allows us to support Python 2.7 and 3.3+

Re: SQLite3 in Python 2.7 Rejecting Foreign Key Insert

2014-11-23 Thread Chris Angelico
On Sun, Nov 23, 2014 at 8:40 PM, Jussi Piitulainen wrote: > Chris Angelico writes: >> On Sun, Nov 23, 2014 at 7:21 PM, Frank Millman wrote: >> >> > To enable them, add the following - >> > >> > pragma foreign_keys = on; >> > >> > It works for me. >> >> Thanks, I went poking around briefly but didn

Re: unloading a module created with imp.new_module

2014-11-23 Thread Ian Kelly
On Sun, Nov 23, 2014 at 2:48 AM, Ian Kelly wrote: > On Sat, Nov 22, 2014 at 11:49 PM, Patrick Stinson > wrote: >> If I create a module with imp.new_module(name), how can I unload it so that >> all the references contained in it are set to zero and the module is >> deleted? deleting the referen

Re: SQLite3 in Python 2.7 Rejecting Foreign Key Insert

2014-11-23 Thread Christian Gollwitzer
Am 23.11.14 07:32, schrieb Chris Angelico: did a sequence of commands which ought to have failed, but didn't. Let's see if I can recreate this: rosuav@sikorsky:~$ sqlite3 SQLite version 3.7.13 2012-06-11 02:05:22 Enter ".help" for instructions Enter SQL statements terminated with a ";" sqlite> c

Re: [ANN] Pylint 1.4 released

2014-11-23 Thread Marko Rauhamaa
Claudiu Popa : > On behalf of the Pylint development team, I'm happy to announce that > Pylint 1.4 has been released. Out of interest, is there something Pylint does CPython shouldn't be doing? IOW, should pylint be an integrated part of CPython? Marko -- https://mail.python.org/mailman/listin

Re: Embedded python 'scripting engine' inside Python app

2014-11-23 Thread Chris Angelico
On Sun, Nov 23, 2014 at 9:28 PM, Patrick Stinson wrote: > Thanks for your great reply. I even augmented the reloading with the same > dict by clearing all of the non-standard symbols from the dict. This > effectively resets the dict: You may as well start with an empty dict and then pick up the f

Re: I have no class

2014-11-23 Thread Seymore4Head
On Sun, 23 Nov 2014 17:00:08 +1100, Chris Angelico wrote: >On Sun, Nov 23, 2014 at 3:15 PM, Seymore4Head > wrote: >> Traceback (most recent call last): >> File "C:\Documents and Settings\Administrator\Desktop\rps.py", line >> 7, in >> a=RPS() >> File "C:\Documents and Settings\Administra

ImportError: cannot import name 'Enum'

2014-11-23 Thread muhammedabuali
Hello all, I am trying to use the python module but when I open the shell and write: ` import enum ` I get the following error ` Traceback (most recent call last): File "", line 1, in File "/usr/lib/python3.4/enum.py", line 3, in from types import MappingProxyType, DynamicClassAttribu

Re: ImportError: cannot import name 'Enum'

2014-11-23 Thread Chris Angelico
On Sun, Nov 23, 2014 at 11:10 PM, wrote: > Hello all, > > I am trying to use the python module but when I open the shell and write: > > ` import enum ` > > I get the following error > > ` Traceback (most recent call last): > File "", line 1, in > File "/usr/lib/python3.4/enum.py", line 3, in

Re: Embedded python 'scripting engine' inside Python app

2014-11-23 Thread Stefan Behnel
Chris Angelico schrieb am 23.11.2014 um 11:35: > On Sun, Nov 23, 2014 at 9:28 PM, Patrick Stinson wrote: >> Is there a better and more secure way to do the python-within-python in >> order allow users to automate your app? > > More secure? Basically no. You could push the inner script into a > sep

Python Signal/Slot + QThred code analysis

2014-11-23 Thread Juan Christian
This is a continuation of my other topic "How to access Qt components loaded from file", it was getting big and the focus changed completely, the real question there was already answered, and we were talking about signal/slot, QThred and other things. So, I read on the web (didn't find books talki

Re: Embedded python 'scripting engine' inside Python app

2014-11-23 Thread Chris Angelico
On Mon, Nov 24, 2014 at 12:20 AM, Patrick Stinson wrote: > I think this is the way I’ll take it, and for all the same reasons. The only > way they can break it is if they really want to. I guess anything other > Franken-apps would be interesting to hear about too. And I’ll still stick it > on t

Comprehension with two variables - explanation needed

2014-11-23 Thread Ivan Evstegneev
Hello guys, I would like to ask you for some explanations on comprehensions. (Don't be scared, it just some particular example ^_^) I found this little "find prime number" example over the internet: >>> noprimes = [j for i in range(2, 8) for j in range(i*2, 50, i)] >>> primes = [x for x

Re: Comprehension with two variables - explanation needed

2014-11-23 Thread Rustom Mody
On Sunday, November 23, 2014 8:28:16 PM UTC+5:30, Ivan Evstegneev wrote: > Hello guys, > > I would like to ask you for some explanations on comprehensions. (Don't be > scared, it just some particular example ^_^) > > I found this little "find prime number" example over the internet: > > >>>

Re: I have no class

2014-11-23 Thread Dave Angel
On 11/23/2014 05:52 AM, Seymore4Head wrote: On Sun, 23 Nov 2014 17:00:08 +1100, Chris Angelico wrote: 1) Python's namespacing rules mean that 'key' is a part of the RPS class, and can be referred to as 'self.key' or as 'RPS.key' 2) Use of 'self.key' for the textual form of the throw is shadow

Re: Comprehension with two variables - explanation needed

2014-11-23 Thread Chris Angelico
On Mon, Nov 24, 2014 at 1:56 AM, Ivan Evstegneev wrote: > > Hello guys, > > I would like to ask you for some explanations on comprehensions. (Don’t be > scared, it just some particular example ^_^) > > I found this little “find prime number” example over the internet: > > >>> noprimes = [j for i

Recurring Task

2014-11-23 Thread tim
Hi All Looking for some advice. I'm creating a small netwok poller and wondered what people recommend to use? Will be polling up to 100 hosts every ten reconds or so Options I can see Home grown using worker threads with Queue and dispatcher based on timestamp Twisted timer service Python Sche

Re: I have no class

2014-11-23 Thread Mark Lawrence
On 23/11/2014 03:55, Rustom Mody wrote: On Sunday, November 23, 2014 9:06:03 AM UTC+5:30, Seymore4Head wrote: Now I am trying to add a dictionary, but it is broke too. How do I fix: class RPS: key={0:"rock", 1:"paper",2:"scissors"}; def __init__(self): self.throw=random.randr

RE: Comprehension with two variables - explanation needed

2014-11-23 Thread Ivan Evstegneev
>Is this what you want? > [[j for j in range(i*2, 50, i)] for i in range(2,8)] >[[4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48], [6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45, 48], [8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48], [10, >15, 20, 25,

Re: ImportError: cannot import name 'Enum'

2014-11-23 Thread muhammedabuali
On Sunday, November 23, 2014 2:20:20 PM UTC+2, Chris Angelico wrote: > On Sun, Nov 23, 2014 at 11:10 PM, wrote: > > Hello all, > > > > I am trying to use the python module but when I open the shell and write: > > > > ` import enum ` > > > > I get the following error > > > > ` Traceback (most rece

Re: Comprehension with two variables - explanation needed

2014-11-23 Thread Chris Angelico
On Mon, Nov 24, 2014 at 2:37 AM, Ivan Evstegneev wrote: > As I know from books and googling, the comps main idea looks approximately > like this: > > [target <--main loop<--nested loop/s (and maybe some conditions)]Am I > right? > > But your code looks somehow inverted to me o_0 > > Like: > >

RE: Comprehension with two variables - explanation needed

2014-11-23 Thread Skip Montanaro
> But it breaks all the picture that I've built in my head about comps till > now... Note that list comprehensions are little more than syntactic sugar for for loops. If you're having terrible writing or understanding one, especially a compound one like your example, it can help to write it as a (

Re: Challenge: optimizing isqrt

2014-11-23 Thread Dave Angel
On 11/21/2014 03:15 AM, Stephen Tucker wrote: On Thu, Nov 20, 2014 at 6:00 PM, Serhiy Storchaka wrote: On 01.11.14 03:29, Steven D'Aprano wrote: There is an algorithm for calculating the integer square root of any positive integer using only integer operations: Here is my optimized im

Re: Comprehension with two variables - explanation needed

2014-11-23 Thread Roy Smith
In article , Skip Montanaro wrote: > > But it breaks all the picture that I've built in my head about comps till > > now... > > Note that list comprehensions are little more than syntactic sugar for for > loops. If you're having terrible writing or understanding one, especially a > compound one

Re: I have no class

2014-11-23 Thread Seymore4Head
On Sun, 23 Nov 2014 10:16:28 -0500, Dave Angel wrote: >On 11/23/2014 05:52 AM, Seymore4Head wrote: >> On Sun, 23 Nov 2014 17:00:08 +1100, Chris Angelico >> wrote: >> >>> >>> 1) Python's namespacing rules mean that 'key' is a part of the RPS >>> class, and can be referred to as 'self.key' or as '

Re: I have no class

2014-11-23 Thread Dave Angel
On 11/23/2014 10:54 AM, Seymore4Head wrote: On Sun, 23 Nov 2014 10:16:28 -0500, Dave Angel wrote: On 11/23/2014 05:52 AM, Seymore4Head wrote: On Sun, 23 Nov 2014 17:00:08 +1100, Chris Angelico wrote: 1) Python's namespacing rules mean that 'key' is a part of the RPS class, and can be refe

Re: PyWart: "Python's import statement and the history of external dependencies"

2014-11-23 Thread Chris Angelico
On Mon, Nov 24, 2014 at 3:23 AM, Dennis Lee Bieber wrote: > On Sun, 23 Nov 2014 18:43:40 +1100, Ben Finney > declaimed the following: > >> PostgreSQL is a full-blown system that is itself under continual >> development, and its APIs continually change to match. Whatever Python >> API for Postg

Re: python 2.7 and unicode (one more time)

2014-11-23 Thread Chris Angelico
On Mon, Nov 24, 2014 at 3:33 AM, Dennis Lee Bieber wrote: > On Sat, 22 Nov 2014 20:52:37 -0500, random...@fastmail.us declaimed the > following: > >>On Sat, Nov 22, 2014, at 18:38, Mark Lawrence wrote: >>> ... >>> That is a standard Windows build. He is again conflating problems with >>> using the

Re: Comprehension with two variables - explanation needed

2014-11-23 Thread Skip Montanaro
On Sun, Nov 23, 2014 at 9:57 AM, Roy Smith wrote: > > If it was complicated enough that you needed to loopify it to > understand what it's doing, have pity on the next person who has to > maintain your code and leave it as a loop Well, sure. I was mostly trying to give Ivan a path out of the weed

Re: Comprehension with two variables - explanation needed

2014-11-23 Thread Rustom Mody
On Sunday, November 23, 2014 9:27:22 PM UTC+5:30, Roy Smith wrote: > Skip Montanaro wrote: > > > > But it breaks all the picture that I've built in my head about comps till > > > now... > > > > Note that list comprehensions are little more than syntactic sugar for for > > loops. If you're having

Re: I have no class

2014-11-23 Thread Seymore4Head
On Sun, 23 Nov 2014 11:14:34 -0500, Dave Angel wrote: >On 11/23/2014 10:54 AM, Seymore4Head wrote: >> On Sun, 23 Nov 2014 10:16:28 -0500, Dave Angel >> wrote: >> >>> On 11/23/2014 05:52 AM, Seymore4Head wrote: On Sun, 23 Nov 2014 17:00:08 +1100, Chris Angelico wrote: > >

Re: I have no class

2014-11-23 Thread Chris Angelico
On Mon, Nov 24, 2014 at 3:49 AM, Seymore4Head wrote: > Like I have said, most of the stuff I am doing is still trial and > error. Having to specify RPS to use it inside the class seemed wrong > to me. > > I haven't read enough about classes yet to know what the correct way > is yet. That's becau

Re: I have no class

2014-11-23 Thread Rustom Mody
On Sunday, November 23, 2014 10:20:05 PM UTC+5:30, Seymore4Head wrote: > Like I have said, most of the stuff I am doing is still trial and > error. Having to specify RPS to use it inside the class seemed wrong > to me. Yes that is natural. Python is a bit odd in the OO-world in that it prioritize

Re: Comprehension with two variables - explanation needed

2014-11-23 Thread Roy Smith
We seem to be somewhat more liberal about nested comprehensions here, but I can't say I'm proud of that :-) 906 Python source files, 109k lines. $ find . -name '*.py' | xargs grep '\[.* for .*\]' | wc -l 729 $ find . -name '*.py' | xargs grep '\[.* for .* for .*\]' | wc -l 46 Without naming n

Re: Comprehension with two variables - explanation needed

2014-11-23 Thread Rustom Mody
On Sunday, November 23, 2014 10:15:51 PM UTC+5:30, Rustom Mody wrote: > 1. I find comprehensions are harder than for-loops -- Heh! Meant to say 'easier' of course... -- https://mail.python.org/mailman/listinfo/python-list

RE: Comprehension with two variables - explanation needed

2014-11-23 Thread Ivan Evstegneev
Got the main idea. Still need to "chew it up" in depth. (As I mentioned I'm a beginner EE student, so please excuse me for my "lameness" ^_^) -Original Message- From: Python-list [mailto:python-list-bounces+webmailgroups=gmail@python.org] On Behalf Of Rustom Mody Sent: Sunday,

Re: Comprehension with two variables - explanation needed

2014-11-23 Thread Jon Ribbens
On 2014-11-23, Roy Smith wrote: > In article , > Skip Montanaro wrote: >> > But it breaks all the picture that I've built in my head about comps till >> > now... >> >> Note that list comprehensions are little more than syntactic sugar for for >> loops. If you're having terrible writing or under

Re: python 2.7 and unicode (one more time)

2014-11-23 Thread random832
On Sun, Nov 23, 2014, at 11:33, Dennis Lee Bieber wrote: > Why would that be possible? Many truetype fonts only supply glyphs for > single-byte encodings (ISO-Latin-1, for example -- pop up the Windows > character map utility and see what some of the font files contain. With a bitmap font se

Re: Recurring Task

2014-11-23 Thread Dan Stromberg
On Sun, Nov 23, 2014 at 7:23 AM, wrote: > Hi All > Looking for some advice. I'm creating a small netwok poller and wondered what > people recommend to use? Will be polling up to 100 hosts every ten reconds or > so > > Options I can see > > Home grown using worker threads with Queue and dispatch

Re: Recurring Task

2014-11-23 Thread Dan Stromberg
On Sun, Nov 23, 2014 at 10:35 AM, Dennis Lee Bieber wrote: > On Sun, 23 Nov 2014 07:23:43 -0800 (PST), t...@timothyarnold.co.uk declaimed > the following: > >>Hi All >>Looking for some advice. I'm creating a small netwok poller and wondered what >>people recommend to use? Will be polling up to 10

Re: python 2.7 and unicode (one more time)

2014-11-23 Thread Dave Angel
On 11/23/2014 01:13 PM, random...@fastmail.us wrote: On Sun, Nov 23, 2014, at 11:33, Dennis Lee Bieber wrote: Why would that be possible? Many truetype fonts only supply glyphs for single-byte encodings (ISO-Latin-1, for example -- pop up the Windows character map utility and see what so

Re: Help with Python Multiprocessing

2014-11-23 Thread Anurag
Hey Socha, Your solution works. But then, all my 3 workers are running in a single command window. How do I make them run in three different command windows? -- https://mail.python.org/mailman/listinfo/python-list

Re: python 2.7 and unicode (one more time)

2014-11-23 Thread Chris Angelico
On Mon, Nov 24, 2014 at 7:31 AM, Dave Angel wrote: > On 11/23/2014 01:13 PM, random...@fastmail.us wrote: >> >> On Sun, Nov 23, 2014, at 11:33, Dennis Lee Bieber wrote: >>> >>> Why would that be possible? Many truetype fonts only supply >>> glyphs for >>> single-byte encodings (ISO-Latin-1

Re: PyWart: "Python's import statement and the history of external dependencies"

2014-11-23 Thread Gregory Ewing
Chris Angelico wrote: Just out of curiosity, why does the stdlib need modules for manipulating .wav and other sound files, but we have to go to PyPI to get a PostgreSQL client? I suspect it's mainly for historical reasons. The wave module has been around since the very early days of Python when

Re: python 2.7 and unicode (one more time)

2014-11-23 Thread Gregory Ewing
Marko Rauhamaa wrote: Unicode strings is not wrong but the technical emphasis on Unicode is as strange as a "tire car" or "rectangular door" when "car" and "door" are what you usually mean. The reason Unicode gets emphasised so much is that until relatively recently, it *wasn't* what "string" u

Re: python 2.7 and unicode (one more time)

2014-11-23 Thread Chris Angelico
On Mon, Nov 24, 2014 at 9:51 AM, Gregory Ewing wrote: > Marko Rauhamaa wrote: >> >> Unicode strings is not wrong but the technical emphasis on Unicode is as >> strange as a "tire car" or "rectangular door" when "car" and "door" are >> what you usually mean. > > > The reason Unicode gets emphasised

"**" in python

2014-11-23 Thread Abdul Abdul
Hello, I came across an example that showed the following: Wxy**2 What do ** mean here? Thanks. -- https://mail.python.org/mailman/listinfo/python-list

Re: "**" in python

2014-11-23 Thread Tim Chase
On 2014-11-24 01:33, Abdul Abdul wrote: > Wxy**2 > > What do ** mean here? "to the power of", so your code squares the value of "Wxy", or "Wxy * Wxy" https://docs.python.org/2/reference/expressions.html#the-power-operator -tkc -- https://mail.python.org/mailman/listinfo/python-list

Re: "**" in python

2014-11-23 Thread Mark Lawrence
On 24/11/2014 00:33, Abdul Abdul wrote: Hello, I came across an example that showed the following: Wxy**2 What do ** mean here? Thanks. You can find out about these by going to https://docs.python.org/3/genindex.html and clicking on 'Symbols' which takes you to https://docs.python.org/3

Re: "**" in python

2014-11-23 Thread Cameron Simpson
On 23Nov2014 18:43, Tim Chase wrote: On 2014-11-24 01:33, Abdul Abdul wrote: Wxy**2 What do ** mean here? "to the power of", so your code squares the value of "Wxy", or "Wxy * Wxy" https://docs.python.org/2/reference/expressions.html#the-power-operator With respect to finding this out for

Re: unloading a module created with imp.new_module

2014-11-23 Thread Ian Kelly
On Nov 23, 2014 4:10 AM, "Patrick Stinson" wrote: > m = types.ModuleType('mine') > exec(s, m.__dict__) > print('deleting...') > m = None > print('done') > > and the output is: > > deleting... > done > __del__ > > I the “__del__" to come between “deleting…” and “done”. This is not being run from th

Re: SQLite3 in Python 2.7 Rejecting Foreign Key Insert

2014-11-23 Thread llanitedave
On Sunday, November 23, 2014 12:22:30 AM UTC-8, Frank Millman wrote: > "Chris Angelico" wrote in message > news:captjjmp4y5zowwn5yftjutko4h5jvtqlantwqepa6b35xnd...@mail.gmail.com... > > > > Entirely possible. I never did track down the actual cause of the > > SQLite3 issues my students were havin

Re: "**" in python

2014-11-23 Thread Dan Stromberg
On Sun, Nov 23, 2014 at 5:00 PM, Cameron Simpson wrote: > On 23Nov2014 18:43, Tim Chase wrote: >> >> On 2014-11-24 01:33, Abdul Abdul wrote: >>> >>> Wxy**2 >>> >>> What do ** mean here? >> >> >> "to the power of", so your code squares the value of "Wxy", or "Wxy * >> Wxy" >> >> https://docs.pytho

Re: "**" in python

2014-11-23 Thread Skip Montanaro
I want to add one more thing to the other responses. People new to Python often seem unaware that being an interpreted language, often the best way to figure something out is to simply try it at the interpreter prompt. The OP saw "var ** 2" in done code. The most obvious thing to me would have been

Re: SQLite3 in Python 2.7 Rejecting Foreign Key Insert

2014-11-23 Thread llanitedave
On Saturday, November 22, 2014 6:11:22 PM UTC-8, llanitedave wrote: > I've built a database in SQLite3 to be embedded into a python application > using wxPython 2.8.12 and Python 2.7.6. I'm using Sqliteman to manage the > database directly and make changes to the structure when necessary. > > O

Re: "**" in python

2014-11-23 Thread llanitedave
On Sunday, November 23, 2014 5:49:05 PM UTC-8, Skip Montanaro wrote: > I want to add one more thing to the other responses. People new to Python > often seem unaware that being an interpreted language, often the best way to > figure something out is to simply try it at the interpreter prompt. The

Re: unloading a module created with imp.new_module

2014-11-23 Thread Ned Batchelder
On 11/23/14 1:49 AM, Patrick Stinson wrote: If I create a module with imp.new_module(name), how can I unload it so that all the references contained in it are set to zero and the module is deleted? deleting the reference that is returned doesn’t seem to do the job, and it’s not in sys.modules,

Why do I keep getting emails from Dennis?

2014-11-23 Thread Sayth Renshaw
I keep receiving emails from Dennis and it appears Dennis only on this list, I am signed up to comp.lang.python and am unsure why I keep getting Dennis' s emails. Sayth -- https://mail.python.org/mailman/listinfo/python-list

Re: Why do I keep getting emails from Dennis?

2014-11-23 Thread Michael Torrie
On 11/23/2014 08:21 PM, Sayth Renshaw wrote: > I keep receiving emails from Dennis and it appears Dennis only on this > list, I am signed up to comp.lang.python and am unsure why I keep getting > Dennis' s emails. If you post to the newsgroup, using your e-mail address as the "from address", when

Re: unloading a module created with imp.new_module

2014-11-23 Thread Steven D'Aprano
On Sat, 22 Nov 2014 21:49:32 -0900, Patrick Stinson wrote: > If I create a module with imp.new_module(name), how can I unload it so > that all the references contained in it are set to zero and the module > is deleted? deleting the reference that is returned doesn’t seem to do > the job, and it’s

Re: I have no class

2014-11-23 Thread Steven D'Aprano
On Sun, 23 Nov 2014 09:02:57 -0800, Rustom Mody wrote: > Python is a bit odd in the OO-world in that it prioritizes "Explicit is > better than implicit" over convenience. > > Notice that you use self.throw where in most other OOP languages you > would use just throw. I don't think that is correc

Re: Comprehension with two variables - explanation needed

2014-11-23 Thread Steven D'Aprano
On Sun, 23 Nov 2014 08:45:39 -0800, Rustom Mody wrote: > 2. "List comprehensions are syntactic sugar for for loops" Cannot > technically quarrel with that as that is the position of the official > docs. > However to me it puts the cart before the horse. Its like saying that > > def foo(x): return

Re: SQLite3 in Python 2.7 Rejecting Foreign Key Insert

2014-11-23 Thread Chris Angelico
On Mon, Nov 24, 2014 at 1:22 PM, llanitedave wrote: > I recreated the table and put the foreign key reference directly into the > field definition: > > "of_borehole TEXT NOT NULL REFERENCES borehole," > > This is a valid alternative according to the SQLite3 docs, if you don't > explicitly define

Re: "**" in python

2014-11-23 Thread Steven D'Aprano
On Sun, 23 Nov 2014 19:48:50 -0600, Skip Montanaro wrote: > I want to add one more thing to the other responses. People new to > Python often seem unaware that being an interpreted language, often the > best way to figure something out is to simply try it at the interpreter > prompt. The OP saw "v

Re: Comprehension with two variables - explanation needed

2014-11-23 Thread Chris Angelico
On Mon, Nov 24, 2014 at 3:42 PM, Steven D'Aprano wrote: > Today dis() returns the above, tomorrow it may return: > > 0 LOAD_GLOBAL 0 (x) > 3 INCREMENT > 5 RETURN_VALUE > > (say), and the Python code remains the same even though the byte code i

Re: python 2.7 and unicode (one more time)

2014-11-23 Thread random832
On Sun, Nov 23, 2014, at 15:31, Dave Angel wrote: > I didn't realize Windows shell (DOS box) had that bug. Course I don't > use Windows much the last few years. > > it's one thing to not display it properly. It's quite another to supply > faulty data to the clipboard. Especially since the Win

Re: I have no class

2014-11-23 Thread Chris Angelico
On Mon, Nov 24, 2014 at 3:21 PM, Steven D'Aprano wrote: > On Sun, 23 Nov 2014 09:02:57 -0800, Rustom Mody wrote: > >> Python is a bit odd in the OO-world in that it prioritizes "Explicit is >> better than implicit" over convenience. >> >> Notice that you use self.throw where in most other OOP lang

Re: I have no class

2014-11-23 Thread Dave Angel
On 11/23/2014 11:21 PM, Steven D'Aprano wrote: In some of these languages, the use of "this/self/me" is optional, but I'm not aware of *any* OOP language where there is no named reference to the current object at all. The case I found astounding in C++ was in the initializer list where the l

Re: "**" in python

2014-11-23 Thread Chris Angelico
On Mon, Nov 24, 2014 at 3:47 PM, Steven D'Aprano wrote: > Hmmm, it appears that ** is a no-op that always returns its left hand > argument: > > py> -1**12 > -1 Ahh but you see, you misunderstand how the whole negative-numbers thing works. You have your syntax wrong. Python was developed by an acc

Re: "**" in python

2014-11-23 Thread Sturla Molden
Abdul Abdul wrote: > Wxy**2 > > What do ** mean here? Exponentiation. Same as ** means in Fortran. Sturla -- https://mail.python.org/mailman/listinfo/python-list

Re: I have no class

2014-11-23 Thread Chris Angelico
On Mon, Nov 24, 2014 at 4:11 PM, Dave Angel wrote: > The case I found astounding in C++ was in the initializer list where the > line > > value:value > > would assume that the first one was this->value, and the second was a local > named value (usually an argument to the constructor). That's

Re: I have no class

2014-11-23 Thread Dave Angel
On 11/24/2014 12:11 AM, Dave Angel wrote: On 11/23/2014 11:21 PM, Steven D'Aprano wrote: In some of these languages, the use of "this/self/me" is optional, but I'm not aware of *any* OOP language where there is no named reference to the current object at all. The case I found astounding in C

Re: PyWart: "Python's import statement and the history of external dependencies"

2014-11-23 Thread Rick Johnson
On Sunday, November 23, 2014 4:37:53 PM UTC-6, Gregory Ewing wrote: > Chris Angelico wrote: > > Just out of curiosity, why does the stdlib need modules > > for manipulating .wav and other sound files, but we have > > to go to PyPI to get a PostgreSQL client? > > I suspect it's mainly for historical

Re: PyWart: "Python's import statement and the history of external dependencies"

2014-11-23 Thread Chris Angelico
On Mon, Nov 24, 2014 at 5:25 PM, Rick Johnson wrote: > The migrant/state symbiosis is a fine example of how we (as > *weak* emotional beings) fall into these "emotional traps" > set by "forked tongued propagandist" in hopes of diverting > our attention away from reality. No being in this universe

Re: Comprehension with two variables - explanation needed

2014-11-23 Thread Rustom Mody
On Monday, November 24, 2014 10:13:04 AM UTC+5:30, Steven D'Aprano wrote: > On Sun, 23 Nov 2014 08:45:39 -0800, Rustom Mody wrote: > > First a one-line solution in haskell > > > > sieve (p:xs) =p:sieve [x | x <- xs, x `mod` p /= 0] > > Don't use that! That is a horribly inefficient way to g

Re: python 2.7 and unicode (one more time)

2014-11-23 Thread Marko Rauhamaa
Gregory Ewing : > Marko Rauhamaa wrote: >> Unicode strings is not wrong but the technical emphasis on Unicode is as >> strange as a "tire car" or "rectangular door" when "car" and "door" are >> what you usually mean. > > The reason Unicode gets emphasised so much is that until relatively > recently

Re: python 2.7 and unicode (one more time)

2014-11-23 Thread Chris Angelico
On Mon, Nov 24, 2014 at 5:57 PM, Marko Rauhamaa wrote: > Yes, people call strings "Unicdoe strings" because Python2 *did have* > unicode strings separate from regular strings: > > Python2Python3 > -- > string bytes (byte strin

Re: python 2.7 and unicode (one more time)

2014-11-23 Thread Marko Rauhamaa
Chris Angelico : > Py3's byte strings are still strings, though. Hm. I don't think so. In a plain English sense, maybe, but that kind of usage can lead to confusion. For example, A subscription selects an item of a sequence (string, tuple or list) or mapping (dictionary) object: subsc