Re: Share Code: Laptop Lid State

2013-07-31 Thread Chris Angelico
On Wed, Jul 31, 2013 at 4:05 AM, Devyn Collier Johnson wrote: > > On 07/30/2013 12:00 PM, Chris Angelico wrote: >> >> On Tue, Jul 30, 2013 at 3:06 PM, Devyn Collier Johnson >> wrote: >>> >>> Aloha everyone! >>> >>> I attached a script that I thought I could share with everyone for >>> your >>

Re: RE Module Performance

2013-07-31 Thread Chris Angelico
On Wed, Jul 31, 2013 at 6:45 AM, Steven D'Aprano wrote: > if you care about minimizing every possible byte, you should > use a low-level language like C. Then you can give every character 21 > bits, and be happy that you don't waste even one bit. Could go better! Since not every character has bee

Re: RE Module Performance

2013-07-31 Thread Antoon Pardon
Op 31-07-13 05:30, Michael Torrie schreef: > On 07/30/2013 12:19 PM, Antoon Pardon wrote: >> So? Why are you making this a point of discussion? I was not aware that >> the pro and cons of various editor buffer implemantations was relevant >> to the point I was trying to make. > > I for one found i

Re: PEP8 79 char max

2013-07-31 Thread llanitedave
It's not just the number of characters, it's the size and the font. Even fixed-width fonts differ greatly in their readability. I can handle different line widths just fine up til about 120 or so without losing the flow of the program, but some fonts simply make it more difficult at any widt

Re: RE Module Performance

2013-07-31 Thread Antoon Pardon
Op 30-07-13 21:09, wxjmfa...@gmail.com schreef: > Matable, immutable, copyint + xxx, bufferint, O(n) > Yes, but conceptualy the reencoding happen sometime, somewhere. Which is a far cry from your previous claim that it happened every time you enter a char. This of course make your case harde

Re: Python script help

2013-07-31 Thread cool1574
Here are some scripts, how do I put them together to create the script I want? (to search a online document and download all the links in it) p.s: can I set a destination folder for the downloads? urllib.urlopen("http://";) possible_urls = re.findall(r'\S+:\S+', text) import urllib2 respons

Re: RE Module Performance

2013-07-31 Thread wxjmfauth
FSR: === The 'a' in 'a€' and 'a\U0001d11e: >>> ['{:#010b}'.format(c) for c in 'a€'.encode('utf-16-be')] ['0b', '0b0111', '0b0010', '0b10101100'] >>> ['{:#010b}'.format(c) for c in 'a\U0001d11e'.encode('utf-32-be')] ['0b', '0b', '0b', '0b0111', '0b00

Re: RE Module Performance

2013-07-31 Thread Antoon Pardon
Op 31-07-13 10:32, wxjmfa...@gmail.com schreef: > Unicode/utf* > > > i) ("primary key") Create and use a unique set of encoded > code points. FSR does this. >>> st1 = 'a€' >>> st2 = 'aa' >>> ord(st1[0]) 97 >>> ord(st2[0]) 97 >>> > ii) ("secondary key") Depending of the wish, > memor

Re: Python descriptor protocol (for more or less structured data)

2013-07-31 Thread CWr
Peter, thanks for your response. Sure, you are right when you say that's easier to use standard attribute assigning via __init__. But my intention was: - reducing the complexiticity of __init__ - avoiding boiler-plates (mostly property descriptors inside of the main class) - creating instances (f

Problem with psycopg2, bytea, and memoryview

2013-07-31 Thread Frank Millman
Hi all I don't know if this question is more appropriate for the psycopg2 list, but I thought I would ask here first. I have some binary data (a gzipped xml object) that I want to store in a database. For PostgreSQL I use a column with datatype 'bytea', which is their recommended way of storin

Re: Problem with psycopg2, bytea, and memoryview

2013-07-31 Thread Antoine Pitrou
Frank Millman chagford.com> writes: > > I have some binary data (a gzipped xml object) that I want to store in a > database. For PostgreSQL I use a column with datatype 'bytea', which is > their recommended way of storing binary strings. > > I use psycopg2 to access the database. It returns bi

Re: Is it that easy to install Python ?

2013-07-31 Thread santiago . diez
OK thanks for your answers. So Python is not a daemon. Is it? Does it have a config file? Actually, each site on the web server is jailed in a chrooted environment. In the chrooted environment, Python appears to be in /usr/bin/python. If I give developers write access to a folder like /usr/lib/p

Repository of non-standard modules.

2013-07-31 Thread Gabor Urban
Hi, I am to start a new free-time project in the next couple of weeks. I am ready to use open accessible Python modules not wanting to reinvent the weel :-) Is there any repository where I can find Python modules not being part of the standard distribution? I have some hits by Google but that see

Re: PEP8 79 char max

2013-07-31 Thread Tim Chase
On 2013-07-31 07:16, Joshua Landau wrote: > On 30 July 2013 18:52, Grant Edwards wrote: >> I also find intializers for tables of data to be much more easily >> read and maintained if the columns can be aligned. > > Why do you have tables in your Python code? I've had occasion to write things like

Re: Repository of non-standard modules.

2013-07-31 Thread Chris Angelico
On Wed, Jul 31, 2013 at 11:53 AM, Gabor Urban wrote: > Hi, > > I am to start a new free-time project in the next couple of weeks. I am > ready to use open accessible Python modules not wanting to reinvent the weel > :-) > Is there any repository where I can find Python modules not being part of >

Re: Problem with psycopg2, bytea, and memoryview

2013-07-31 Thread Frank Millman
"Antoine Pitrou" wrote in message news:loom.20130731t114936-...@post.gmane.org... > Frank Millman chagford.com> writes: >> >> I have some binary data (a gzipped xml object) that I want to store in a >> database. For PostgreSQL I use a column with datatype 'bytea', which is >> their recommended

importing modules

2013-07-31 Thread syed khalid
I am attempting to import modules from Shogun to python from a non-standard python directory ie from my /home/xxx directory. is there a way on ubuntu to selectively some modules, scripts, data from one directory and others modules, scripts from another directory. In other words, is there a file(s)

Re: email 8bit encoding

2013-07-31 Thread Antoon Pardon
Op 29-07-13 01:41, ru...@yahoo.com schreef: How, using Python-3.3's email module, do I "flatten" (I think that's the right term) a Message object to get utf-8 encoded body with the headers: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit when the message payload was se

Re: import syntax

2013-07-31 Thread Chris Angelico
On Mon, Jul 29, 2013 at 11:37 PM, Joshua Landau wrote: > 2d) Realise that the slow part is not what you thought it was This step is mandatory. ChrisA -- http://mail.python.org/mailman/listinfo/python-list

Re: Prime number generator

2013-07-31 Thread Ian Kelly
On Tue, Jul 30, 2013 at 4:58 AM, Albert van der Horst wrote: > Notice that all values from i on are possibly present. > So you are better off with a list indexed by forthcoming i's and > each item containing a list of primes. What you do then, more or less, > is keep track of all dividers of prime

Lambda function Turing completeness

2013-07-31 Thread Musical Notation
Is it possible to write a Turing-complete lambda function (which does not depend on named functions) in Python? -- http://mail.python.org/mailman/listinfo/python-list

Script that converts between indentation and curly braces in Python code

2013-07-31 Thread Musical Notation
Is there any script that converts indentation in Python code to curly braces? The indentation is sometime lost when I copy my code to an application or a website. -- http://mail.python.org/mailman/listinfo/python-list

Re: Script that converts between indentation and curly braces in Python code

2013-07-31 Thread Joel Goldstick
On Tue, Jul 30, 2013 at 11:45 PM, Musical Notation wrote: > Is there any script that converts indentation in Python code to curly braces? > The indentation is sometime lost when I copy my code to an application or a > website. I guess you could google that. What do you mean that indentation is

Re: Script that converts between indentation and curly braces in Python code

2013-07-31 Thread Beth McNany
from __future__ import braces ;) ok, ok, if you *really* want it, you could keep track of how many leading spaces there are (you are using spaces, right?), and insert an open bracket where that number increases and a closing bracket where it decreases. Of course, as with all parsing problems, thi

Re: PEP8 79 char max

2013-07-31 Thread Neil Cerutti
On 2013-07-31, Tim Chase wrote: > On 2013-07-31 07:16, Joshua Landau wrote: >> On 30 July 2013 18:52, Grant Edwards wrote: >>> I also find intializers for tables of data to be much more easily >>> read and maintained if the columns can be aligned. >> >> Why do you have tables in your Python code?

Re: Problem with psycopg2, bytea, and memoryview

2013-07-31 Thread Antoine Pitrou
Frank Millman chagford.com> writes: > > Thanks for that, Antoine. It is an improvement over tobytes(), but i am > afraid it is still not ideal for my purposes. I would suggest asking the psycopg2 project why they made this choice, and if they would reconsider. Returning a memoryview doesn't mak

Re: Lambda function Turing completeness

2013-07-31 Thread Schneider
On Wed 31 Jul 2013 08:53:26 AM CEST, Musical Notation wrote: Is it possible to write a Turing-complete lambda function (which does not depend on named functions) in Python? what should a sinlge Turing-complete lambda function be? For me, a programming language can be Turing-complete or a funct

Re: Script that converts between indentation and curly braces in Python code

2013-07-31 Thread Neil Hodgson
Musical Notation: Is there any script that converts indentation in Python code to curly braces? The indentation is sometime lost when I copy my code to an application or a website. pindent.py in the Tools/Scripts directory of Python installations does something similar by adding or removi

Re: Script that converts between indentation and curly braces in Python code

2013-07-31 Thread Serhiy Storchaka
31.07.13 06:45, Musical Notation написав(ла): Is there any script that converts indentation in Python code to curly braces? The indentation is sometime lost when I copy my code to an application or a website. Look at the pindent.py script. -- http://mail.python.org/mailman/listinfo/python-li

Re: Script that converts between indentation and curly braces in Python code

2013-07-31 Thread Musical Notation
On Jul 31, 2013, at 19:27, IshIsh wrote: > Try from __future__ import braces as the first line of a source file (or > typing it in an interactive session), and watch the interpreter's > response... "SyntaxError: not a chance" I already know that.-- http://mail.python.org/mailman/listinfo/p

Re: Problem with psycopg2, bytea, and memoryview

2013-07-31 Thread Frank Millman
"Antoine Pitrou" wrote in message news:loom.20130731t150154-...@post.gmane.org... > Frank Millman chagford.com> writes: >> >> Thanks for that, Antoine. It is an improvement over tobytes(), but i am >> afraid it is still not ideal for my purposes. > > I would suggest asking the psycopg2 project

Re: Script that converts between indentation and curly braces in Python code

2013-07-31 Thread Chris Angelico
On Wed, Jul 31, 2013 at 1:39 PM, Beth McNany wrote: > ok, ok, if you *really* want it, you could keep track of how many leading > spaces there are (you are using spaces, right?), and insert an open bracket > where that number increases and a closing bracket where it decreases. Of > course, as wit

Re: Script that converts between indentation and curly braces in Python code

2013-07-31 Thread Rotwang
On 31/07/2013 14:55, Chris Angelico wrote: [...] Since the braced version won't run anyway, how about a translation like this: def foo(): print("""Hello, world!""") for i in range(5): foo() return 42 --> 0-def foo(): 4-print("""Hello, 0-world!""") 4-for i in range(5):

Re: Problem with psycopg2, bytea, and memoryview

2013-07-31 Thread Neil Cerutti
On 2013-07-31, Frank Millman wrote: > > "Antoine Pitrou" wrote in message > news:loom.20130731t114936-...@post.gmane.org... >> Frank Millman chagford.com> writes: >>> >>> I have some binary data (a gzipped xml object) that I want to store in a >>> database. For PostgreSQL I use a column with da

Re: Script that converts between indentation and curly braces in Python code

2013-07-31 Thread Joel Goldstick
So, why do you want to do this? As has been pointed out, its a difficult and likely sizable task to build such a parser. In the end you get something that isn't a computer language -- even tho it looks like one. And it also is probably just as big a job to convert it back to python. So, what is

Re: RE Module Performance

2013-07-31 Thread Michael Torrie
On 07/31/2013 01:23 AM, Antoon Pardon wrote: > Op 31-07-13 05:30, Michael Torrie schreef: >> On 07/30/2013 12:19 PM, Antoon Pardon wrote: >>> So? Why are you making this a point of discussion? I was not aware that >>> the pro and cons of various editor buffer implemantations was relevant >>> to the

Re: Script that converts between indentation and curly braces in Python code

2013-07-31 Thread Chris Angelico
On Wed, Jul 31, 2013 at 3:07 PM, Rotwang wrote: >> # Assumes spaces OR tabs but not both >> # Can't see an easy way to count leading spaces other than: >> # len(s)-len(s.lstrip()) > > > How about len(s.expandtabs()) - len(s.lstrip()) instead? Still comes to the same thing. The only diff is that t

Re: binary key in dictionary

2013-07-31 Thread John Gordon
In <9004a556-958f-4d1d-81a7-4d1b73134...@googlegroups.com> cerr writes: > Traceback (most recent call last): > File "gateway.py", line 2485, in > main() > File "gateway.py", line 2459, in main > cloud_check() > File "gateway.py", line 770, in cloud_check > gnstr_dict[src] = gn

Re: RE Module Performance

2013-07-31 Thread Michael Torrie
On 07/31/2013 02:32 AM, wxjmfa...@gmail.com wrote: > Unicode/utf* Why do you keep using the terms "utf" and "Unicode" interchangeably? -- http://mail.python.org/mailman/listinfo/python-list

script to Login a website

2013-07-31 Thread wachkama
I have created a script to log in a website. It gets its username and password from two files, then log's in with this credentials. My code is not showing me what username it is using to login from the file. And I am not sure if it is even opening up the url and prompting for login. I am stuck

Re: how to package embedded python?

2013-07-31 Thread David M. Cotter
okay, well that might turn out to be useful, except i don't quite know how to use it, and there are no "from scratch" instructions. i managed to download "py2exe-0.6.9.zip" and unzip it, but how does one "install" this package? (yes, still a newb at that) then, once installed, how do i say "in

Re: script to Login a website

2013-07-31 Thread John Gordon
In wachk...@gmail.com writes: > I have created a script to log in a website. It gets its username and > password from two files, then log's in with this credentials. My code is > not showing me what username it is using to login from the file. And I am > not sure if it is even opening up the url

Re: PEP8 79 char max

2013-07-31 Thread Grant Edwards
On 2013-07-31, Tim Chase wrote: > On 2013-07-31 07:16, Joshua Landau wrote: >> On 30 July 2013 18:52, Grant Edwards wrote: >>> I also find intializers for tables of data to be much more easily >>> read and maintained if the columns can be aligned. >> >> Why do you have tables in your Python code?

Re: PEP8 79 char max

2013-07-31 Thread Grant Edwards
On 2013-07-31, Neil Cerutti wrote: > On 2013-07-31, Tim Chase wrote: >> On 2013-07-31 07:16, Joshua Landau wrote: >>> On 30 July 2013 18:52, Grant Edwards wrote: I also find intializers for tables of data to be much more easily read and maintained if the columns can be aligned. >>> >>>

Re: Is it that easy to install Python ?

2013-07-31 Thread Ian Kelly
On Wed, Jul 31, 2013 at 4:08 AM, wrote: > OK thanks for your answers. > So Python is not a daemon. Is it? No. > Does it have a config file? Not as such. Arbitrary site-specific customization can be done by creating a sitecustomize module, but this is not standard. There are also some environ

Re: Is it that easy to install Python ?

2013-07-31 Thread Ian Kelly
On Wed, Jul 31, 2013 at 10:44 AM, Ian Kelly wrote: > and then set the PYTHONHOME environment variable to /usr/lib. Rather, just /usr. -- http://mail.python.org/mailman/listinfo/python-list

Re: script to Login a website

2013-07-31 Thread wachkama
On Wednesday, July 31, 2013 12:21:59 PM UTC-4, John Gordon wrote: > In wachk...@gmail.com > writes: > > > > > I have created a script to log in a website. It gets its username and > > > password from two files, then log's in with this credentials. My code is > > > not showing me what usernam

Re: Repository of non-standard modules.

2013-07-31 Thread Ian Kelly
On Wed, Jul 31, 2013 at 5:02 AM, Chris Angelico wrote: > On Wed, Jul 31, 2013 at 11:53 AM, Gabor Urban wrote: >> Hi, >> >> I am to start a new free-time project in the next couple of weeks. I am >> ready to use open accessible Python modules not wanting to reinvent the weel >> :-) >> Is there any

Re: Lambda function Turing completeness

2013-07-31 Thread Ian Kelly
On Wed, Jul 31, 2013 at 12:53 AM, Musical Notation wrote: > Is it possible to write a Turing-complete lambda function (which does not > depend on named functions) in Python? Yes, lambda functions are Turing-complete. You can get anonymous recursion by defining the function to take a recursive f

Re: PEP8 79 char max

2013-07-31 Thread Marcelo MD
> > In my experience, aligning columns in large tables reduces maintence > cost by making it much easier/faster to see what you've got and by > providing a way to visually "prompt" you for the correct value in the > correct place when you add new lines. > > Works great until one of the values chang

Re: Python descriptor protocol (for more or less structured data)

2013-07-31 Thread Terry Reedy
On 7/31/2013 5:16 AM, CWr wrote: Peter, thanks for your response. Sure, you are right when you say that's easier to use standard attribute assigning via __init__. But my intention was: - reducing the complexiticity of __init__ - avoiding boiler-plates (mostly property descriptors inside of the

ImportError: No module named appengine.ext

2013-07-31 Thread Jaiky
hey learning python problem facing is under when typing on interpreter >>> from google.appengine.ext import db Traceback (most recent call last): File "", line 1, in ImportError: No module named appengine.ext what to do please help . -- http://mail.python.org/mailman/listinfo/python-l

Re: Problem with psycopg2, bytea, and memoryview

2013-07-31 Thread Terry Reedy
On 7/31/2013 9:07 AM, Antoine Pitrou wrote: Frank Millman chagford.com> writes: Thanks for that, Antoine. It is an improvement over tobytes(), but i am afraid it is still not ideal for my purposes. I would suggest asking the psycopg2 project why they made this choice, and if they would recon

Re: PEP8 79 char max

2013-07-31 Thread Skip Montanaro
=> Works great until one of the values changes in size. Slightly off-topic, but still sort of related (talking about the size of things), I started picking 1e+30 as my "really big" some time back because the repr of 1e+99 required more than a glance when it appeared in printed output: >>> repr(1e

Re: PEP8 79 char max

2013-07-31 Thread Neil Cerutti
On 2013-07-31, Marcelo MD wrote: >> In my experience, aligning columns in large tables reduces >> maintence cost by making it much easier/faster to see what >> you've got and by providing a way to visually "prompt" you for >> the correct value in the correct place when you add new lines. > > Works

Re: PEP8 79 char max

2013-07-31 Thread Tim Chase
On 2013-07-31 16:32, Grant Edwards wrote: > On 2013-07-31, Tim Chase wrote: > > I interpret Grant's statement as wanting the "table" to look like > > > > for name, value, description in ( > > ("cost", 42, "How much it cost"), > > ("status", 3141, "Status code from ISO-3.14159"),

Re: PEP8 79 char max

2013-07-31 Thread Grant Edwards
On 2013-07-31, Neil Cerutti wrote: > Besides, after studying The Pragmatic Programmer I removed nearly > all the tables from my code and reference them (usually with csv > module) instead. I don't understand. That just moves them to a different file -- doesn't it? You've still got to deal with

Re: PEP8 79 char max

2013-07-31 Thread Tim Chase
On 2013-07-31 16:32, Grant Edwards wrote: > On 2013-07-31, Tim Chase wrote: > > I interpret Grant's statement as wanting the "table" to look like > > > > for name, value, description in ( > > ("cost", 42, "How much it cost"), > > ("status", 3141, "Status code from ISO-3.14159")

Re: ImportError: No module named appengine.ext

2013-07-31 Thread Chris “Kwpolska” Warrick
On Wed, Jul 31, 2013 at 7:51 PM, Jaiky wrote: > hey learning python > > problem facing is under when typing on interpreter > > from google.appengine.ext import db > Traceback (most recent call last): > File "", line 1, in > ImportError: No module named appengine.ext > > > what to do please

Re: ImportError: No module named appengine.ext

2013-07-31 Thread John Gordon
In <719f0bd8-cddc-4b28-97ee-08b56d359...@googlegroups.com> Jaiky writes: > >>> from google.appengine.ext import db > Traceback (most recent call last): > File "", line 1, in > ImportError: No module named appengine.ext > what to do please help . Has the Google App Engine library been in

Re: ImportError: No module named appengine.ext

2013-07-31 Thread Jaiky
you mean to say SDK for python ?/ -- http://mail.python.org/mailman/listinfo/python-list

Using system python vs. updated/current version

2013-07-31 Thread memilanuk
Hello there, What would be considered the correct/best way to run a current release of python locally vs. the installed system version? On openSUSE 12.3, the repos currently have 2.7.3 and 3.3.0. As far as I know, I'm not really hitting any limitations with the existing versions - my skills just

Editing tabular data [was: PEP8 79 char max]

2013-07-31 Thread Skip Montanaro
> I don't understand. That just moves them to a different file -- > doesn't it? You've still got to deal with editing a large table of > data (for example when I want to add instructions to your assembler). My guess is it would be more foolproof to edit that stuff with a spreadsheet. Skip -- h

RE: PEP8 79 char max

2013-07-31 Thread Prasad, Ramit
Grant Edwards wrote: > On 2013-07-31, Neil Cerutti wrote: > > > Besides, after studying The Pragmatic Programmer I removed nearly > > all the tables from my code and reference them (usually with csv > > module) instead. > > I don't understand. That just moves them to a different file -- > doesn

Re: PEP8 79 char max

2013-07-31 Thread Neil Cerutti
On 2013-07-31, Grant Edwards wrote: > On 2013-07-31, Neil Cerutti wrote: >> Besides, after studying The Pragmatic Programmer I removed >> nearly all the tables from my code and reference them (usually >> with csv module) instead. > > I don't understand. That just moves them to a different file >

Re: PEP8 79 char max

2013-07-31 Thread Grant Edwards
On 2013-07-31, Neil Cerutti wrote: > On 2013-07-31, Grant Edwards wrote: >> On 2013-07-31, Neil Cerutti wrote: >>> Besides, after studying The Pragmatic Programmer I removed >>> nearly all the tables from my code and reference them (usually >>> with csv module) instead. >> >> I don't understand.

Re: Editing tabular data [was: PEP8 79 char max]

2013-07-31 Thread Grant Edwards
On 2013-07-31, Skip Montanaro wrote: >> I don't understand. That just moves them to a different file -- >> doesn't it? You've still got to deal with editing a large table of >> data (for example when I want to add instructions to your assembler). > > My guess is it would be more foolproof to edi

Re: Editing tabular data [was: PEP8 79 char max]

2013-07-31 Thread Neil Cerutti
On 2013-07-31, Rhodri James wrote: > On Wed, 31 Jul 2013 19:39:29 +0100, Skip Montanaro wrote: > >>> I don't understand. That just moves them to a different file -- >>> doesn't it? You've still got to deal with editing a large table of >>> data (for example when I want to add instructions to yo

Re: Editing tabular data [was: PEP8 79 char max]

2013-07-31 Thread Rhodri James
On Wed, 31 Jul 2013 19:39:29 +0100, Skip Montanaro wrote: I don't understand. That just moves them to a different file -- doesn't it? You've still got to deal with editing a large table of data (for example when I want to add instructions to your assembler). My guess is it would be more foo

pcurl and network connection's problem

2013-07-31 Thread sam319
I am having problems with pycurl in my threads , when i run it , it does correctly but some times the connection has been established but nothing will be downloaded and the threads stay alive without doing any thing (especially when the network's speed is slow and has aborted status) . i can't

RE: Using system python vs. updated/current version

2013-07-31 Thread Prasad, Ramit
memilanuk wrote: > Hello there, > > What would be considered the correct/best way to run a current release > of python locally vs. the installed system version? On openSUSE 12.3, > the repos currently have 2.7.3 and 3.3.0. As far as I know, I'm not > really hitting any limitations with the exist

Re: PEP8 79 char max

2013-07-31 Thread Neil Cerutti
On 2013-07-31, Grant Edwards wrote: > On 2013-07-31, Neil Cerutti wrote: >> On 2013-07-31, Grant Edwards wrote: >>> On 2013-07-31, Neil Cerutti wrote: Besides, after studying The Pragmatic Programmer I removed nearly all the tables from my code and reference them (usually with cs

RE: pcurl and network connection's problem

2013-07-31 Thread Prasad, Ramit
sam319 wrote: > I am having problems with pycurl in my threads , when i run it , it does > correctly but some times the > connection has been established but nothing will be downloaded and the > threads stay alive without > doing any thing (especially when the network's speed is slow and has abor

Re: Editing tabular data [was: PEP8 79 char max]

2013-07-31 Thread Skip Montanaro
>> My guess is it would be more foolproof to edit that stuff with a >> spreadsheet. > > Many years ago, I worked with somebody who used a spreadsheet like > that. I really love Emacs, however... One of the traders here where I work (who shall not be named) had a space-delimited data file with hun

Re: RE Module Performance

2013-07-31 Thread wxjmfauth
Le mercredi 31 juillet 2013 07:45:18 UTC+2, Steven D'Aprano a écrit : > On Tue, 30 Jul 2013 12:09:11 -0700, wxjmfauth wrote: > > > > > And do not forget, in a pure utf coding scheme, your char or a char will > > > *never* be larger than 4 bytes. > > > > > sys.getsizeof('a') > > > 26 >

Re: Using system python vs. updated/current version

2013-07-31 Thread memilanuk
On 07/31/2013 12:17 PM, Prasad, Ramit wrote: > You should be able to install both Python 2 and 3 in most modern > Linux distributions (at the same time). I would not change the system > Python version. I hadn't really planned on mucking with the system python... I recall from a long while back (on

Re: Using system python vs. updated/current version

2013-07-31 Thread Terry Reedy
On 7/31/2013 2:35 PM, memilanuk wrote: Hello there, What would be considered the correct/best way to run a current release of python locally vs. the installed system version? On openSUSE 12.3, the repos currently have 2.7.3 and 3.3.0 released April 2012. 2.7.5 100+?? bug fixes. and released

Re: script to Login a website

2013-07-31 Thread Joel Goldstick
On Wed, Jul 31, 2013 at 11:33 AM, wrote: > > I have created a script to log in a website. It gets its username and > password from two files, then log's in with this credentials. My code is not > showing me what username it is using to login from the file. And I am not > sure if it is even ope

Re: Editing tabular data [was: PEP8 79 char max]

2013-07-31 Thread Wanderer
On Wednesday, July 31, 2013 2:39:29 PM UTC-4, Skip Montanaro wrote: > > I don't understand. That just moves them to a different file -- > > > doesn't it? You've still got to deal with editing a large table of > > > data (for example when I want to add instructions to your assembler). > > > >

Re: RE Module Performance

2013-07-31 Thread Chris Angelico
On Wed, Jul 31, 2013 at 9:15 PM, wrote: > ... char never consumes or requires more than 4 bytes ... > The integer 5 should be able to be stored in 3 bits. >>> sys.getsizeof(5) 14 Clearly Python is doing something really horribly wrong here. In fact, sys.getsizeof needs to be changed to return

Re: Using system python vs. updated/current version

2013-07-31 Thread Terry Reedy
On 7/31/2013 4:19 PM, memilanuk wrote: Are there any significant flaws with v.3.3.0 that would necessitate upgrading to the most recent version (3.3.2?) Go to the overview page http://docs.python.org/3/index.html and click on 'What's new in Python 3.3' to get to http://docs.python.org/3/whats

Re: Editing tabular data [was: PEP8 79 char max]

2013-07-31 Thread Skip Montanaro
> Has anyone tried Pyspread? I have not. I have a fundamental problem with spreadsheets, the extremely narrow view of the workspace. There was a piece on NPR the other day about some errors in some modeling applications. I missed most of it (does someone have a link? I'm on my phone right now), b

Re: Using system python vs. updated/current version

2013-07-31 Thread alex23
On 1/08/2013 4:35 AM, memilanuk wrote: Also... in some places in the 'Net I see references to installing everything 'locally' via pip, etc. in virtualenvs and not touching the system installed version of python... yet most linux distros seem to have many/most such packages available in their pack

Re: Editing tabular data [was: PEP8 79 char max]

2013-07-31 Thread Chris Angelico
On Wed, Jul 31, 2013 at 8:02 PM, Grant Edwards wrote: > On 2013-07-31, Skip Montanaro wrote: >>> I don't understand. That just moves them to a different file -- >>> doesn't it? You've still got to deal with editing a large table of >>> data (for example when I want to add instructions to your a

Re: Using system python vs. updated/current version

2013-07-31 Thread Chris Angelico
On Wed, Jul 31, 2013 at 7:35 PM, memilanuk wrote: > Also... in some places in the 'Net I see references to installing > everything 'locally' via pip, etc. in virtualenvs and not touching the > system installed version of python... yet most linux distros seem to > have many/most such packages avail

Re: Python script help

2013-07-31 Thread alex23
On 31/07/2013 6:15 PM, cool1...@gmail.com wrote: Here are some scripts, how do I put them together to create the script I want? (to search a online document and download all the links in it) 1. Think about the requirements. 2. Write some code. 3. Test it. 4. Repeat until requirements are met.

Re: Lambda function Turing completeness

2013-07-31 Thread Steven D'Aprano
On Wed, 31 Jul 2013 13:53:26 +0700, Musical Notation wrote: > Is it possible to write a Turing-complete lambda function (which does > not depend on named functions) in Python? lambda s: eval(s) -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: Problem with psycopg2, bytea, and memoryview

2013-07-31 Thread dieter
"Frank Millman" writes: > ... > At present, I loop over a range of columns, comparing 'before' and 'after' > values, without worrying about their types. Strings are returned as str, > integers are returned as int, etc. Now I will have to check the type of each > column before deciding whether

Re: Script that converts between indentation and curly braces in Python code

2013-07-31 Thread Steven D'Aprano
On Wed, 31 Jul 2013 10:45:36 +0700, Musical Notation wrote: > Is there any script that converts indentation in Python code to curly > braces? The indentation is sometime lost when I copy my code to an > application or a website. Complain to the website or application that it is throwing away sig

Re: Unexpected results comparing float to Fraction

2013-07-31 Thread Steven D'Aprano
On Wed, 31 Jul 2013 15:23:21 -0500, Tony the Tiger wrote: > On Mon, 29 Jul 2013 15:43:24 +, Steven D'Aprano wrote: > >> Am I the only one who is surprised by this? > > Most likely. > > Floats aren't precise enough to be equal to a (true) fraction. > float(1/3) is cut short somewhere by the

Oddity with 'yield' as expression - parentheses demanded

2013-07-31 Thread Chris Angelico
Was playing around with yield inside a lambda and ran into a distinct oddity. Python 3.3.0 (v3.3.0:bd8afb90ebf2, Sep 29 2012, 10:55:48) [MSC v.1600 32 bit (Intel)] on win32 >>> foo=lambda x: yield(x) SyntaxError: invalid syntax >>> def foo(x): return yield(x) SyntaxError: invalid syntax >>

Re: Unexpected results comparing float to Fraction

2013-07-31 Thread Chris Angelico
On Thu, Aug 1, 2013 at 7:20 AM, Steven D'Aprano wrote: > I know this, and that's not what surprised me. What surprised me was that > Fraction converts the float to a fraction, then compares. It surprises me > because in other operations, Fractions down-cast to float. > > Adding a float to a Fracti