Re: You gotta love a 2-line python solution

2016-05-01 Thread Stephen Hansen
-- Note, for paths on windows you really want to use a rawstring. Ie, r"D:\file.html". -- Stephen Hansen m e @ i x o k a i . i o -- https://mail.python.org/mailman/listinfo/python-list

Re: Not x.islower() has different output than x.isupper() in list output...

2016-04-30 Thread Stephen Hansen
On Sat, Apr 30, 2016, at 09:48 AM, Christopher Reimer wrote: > On 4/29/2016 11:43 PM, Stephen Hansen wrote: > > The official documentation is accurate. > > That may be true on a technical level. But the identically worded text > in the documentation implies otherwise. That

Re: Not x.islower() has different output than x.isupper() in list output...

2016-04-29 Thread Stephen Hansen
On Fri, Apr 29, 2016, at 06:55 PM, Christopher Reimer wrote: > On 4/29/2016 6:29 PM, Stephen Hansen wrote: > > If isupper/islower were perfect opposites of each-other, there'd be no > > need for both. But since characters can be upper, lower, or *neither*, > > y

Re: Not x.islower() has different output than x.isupper() in list output...

2016-04-29 Thread Stephen Hansen
t x.isupper()" you'd get the whitespace in it too (along with all the lower case characters). If isupper/islower were perfect opposites of each-other, there'd be no need for both. But since characters can be upper, lower, or *neither*, you run into this situation. -- Stephen Hansen m e @ i x o k a i . i o -- https://mail.python.org/mailman/listinfo/python-list

Re: Python Madlibs.py code and error message

2016-04-28 Thread Stephen Hansen
On Wed, Apr 27, 2016, at 11:55 PM, Ben Finney wrote: > Stephen Hansen writes: > > > On Wed, Apr 27, 2016, at 10:32 PM, Ben Finney wrote: > > > Better: when you have many semantically-different values, use named > > > (not positional) parameters in the format stri

Re: Python Madlibs.py code and error message

2016-04-27 Thread Stephen Hansen
On Wed, Apr 27, 2016, at 10:32 PM, Ben Finney wrote: > Stephen Hansen writes: > > > The error message means there's a mismatch between the number of > > formatting instructions (ie, %s) and arguments passed to formatting. I > > leave it to you to count and find wha

Re: Python Madlibs.py code and error message

2016-04-27 Thread Stephen Hansen
rmatting. I leave it to you to count and find what's missing or extra, because I'm seriously not going to do that :) -- Stephen Hansen m e @ i x o k a i . i o -- https://mail.python.org/mailman/listinfo/python-list

Re: Python Madlibs.py code and error message

2016-04-27 Thread Stephen Hansen
) Python is case-sensitive. "Adjective1" and "adjective1" are separate things. In your code you're reading into "adjective1". -- Stephen Hansen m e @ i x o k a i . i o -- https://mail.python.org/mailman/listinfo/python-list

Re: Python path and append

2016-04-27 Thread Stephen Hansen
e tracebacks. Having a nice description of what you expect to happen is often nice too, especially if its doing something "wrong" and not giving an obvious traceback. Seeing specifically what the wrong behavior is, and you explaining why you think its wrong, can be invaluable. -- Stephen Hansen m e @ i x o k a i . i o -- https://mail.python.org/mailman/listinfo/python-list

Re: Python(x,y) 64 bit

2016-04-27 Thread Stephen Hansen
ads which is the Anaconda scientific distribution, which I know does offer 64-bit Python support. --- Stephen Hansen m e @ i x o k a i . i o -- https://mail.python.org/mailman/listinfo/python-list

Re: How much sanity checking is required for function inputs?

2016-04-21 Thread Stephen Hansen
On Thu, Apr 21, 2016, at 08:33 PM, Christopher Reimer wrote: > On 4/21/2016 7:20 PM, Stephen Hansen wrote: > > I... that... what... I'd forget that link and pretend you never went > > there. Its not helpful. > > I found it on the Internet, so it must be true -- and Pytho

Re: How much sanity checking is required for function inputs?

2016-04-21 Thread Stephen Hansen
at all. What's the contents of this big dictionary that has everything in it for some reason? That said, dear god, 'piece' doesn't look like an english word to me anymore. I've never suffered semantic satiation from text before. --Stephen m e @ i x o k a i . i o -- https://mail.python.org/mailman/listinfo/python-list

Re: Fwd: Re: Error 0*80070570

2016-04-21 Thread Stephen Hansen
On Thu, Apr 21, 2016, at 10:46 AM, Allan Leo wrote: > I need help with this setup error. > -- Forwarded message -- > From: "Allan Leo" > Date: Apr 21, 2016 10:06 AM > Subject: Re: Error 0*80070570 > To: > Cc: > > When running the setup for your 3.5.1(32-bit version), the setup >

Re: Running lpr on windows from python

2016-04-20 Thread Stephen Hansen
mmandline = r"C:\windows\system32\lpr.exe -S 172.28.84.38 -P RAW C:\john\myfile" The r in front of the string makes it a raw string so you don't have to double up the slashes. --- Stephen Hansen m e @ i x o k a i . i o -- https://mail.python.org/mailman/listinfo/python-list

Re: How much sanity checking is required for function inputs?

2016-04-19 Thread Stephen Hansen
On Tue, Apr 19, 2016, at 11:09 PM, Ethan Furman wrote: > On 04/19/2016 10:51 PM, Stephen Hansen wrote: > > I use 1) more to be less 'nicer' and more, er, 'more specific'. Since I > > don't like exceptions to rise to the user level where niceness is > &g

Re: How much sanity checking is required for function inputs?

2016-04-19 Thread Stephen Hansen
n user error messages, not exceptions. Note, 1) doesn't mean I always raise a nicer message, it means if "KeyError" is ambiguious or odd, I raise a better and more informative one. But you're getting nothing swapping out KeyError for Exception(lotsofwords). I use 1) more to be less 'nicer' and more, er, 'more specific'. Since I don't like exceptions to rise to the user level where niceness is needed. --Stephen m e @ i x o k a i . i o -- https://mail.python.org/mailman/listinfo/python-list

Re: Python 2.7

2016-04-16 Thread Stephen Hansen
bian, it should come pre-installed. --- Stephen Hansen m e @ i x o k a i . i o -- https://mail.python.org/mailman/listinfo/python-list

Re: Guido sees the light: PEP 8 updated

2016-04-16 Thread Stephen Hansen
the core devs taste and particular needs, and it goes out of its way to say that it is only a suggestion and other concerns (especially local consistency) override its advice. --- Stephen Hansen m e @ i x o k a i . i o -- https://mail.python.org/mailman/listinfo/python-list

Re: sys.exit(1) vs raise SystemExit vs raise

2016-04-15 Thread Stephen Hansen
> * You can use named constants from ‘os’ for the purpose of specifying > exit status numbers. Only on *nix. Even then it varies from platform to platform which constants you can use. I'd prefer to document the return status and use numbers/my own constants directly, that way supporting any p

Re: How to XOR a byte output?

2016-04-13 Thread Stephen Hansen
at which point its no longer bytes (and before you did something to it besides displaying it, you'd want to decode it back to bytes again, probably). --Stephen m e @ i x o k a i . i o -- https://mail.python.org/mailman/listinfo/python-list

Re: hourly weather forecast data

2016-04-12 Thread Stephen Hansen
etch a RSS feed from Wunderground. But that was awhile ago and I don't see the obvious RSS links banymore. Did you see: https://www.wunderground.com/weather/api/d/docs -- Stephen Hansen m e @ i x o k a i . i o -- https://mail.python.org/mailman/listinfo/python-list

Re: The reason I uninstalled Python 3.5.1 (32-bit) for Windows

2016-04-12 Thread Stephen Hansen
folder. If you can't use pip while in the same directory as pip.exe, I don't even know what is wrong. That said, you can access pip via 'python -m pip args' instead of using the pip executable. -- Stephen Hansen m e @ i x o k a i . i o -- https://mail.python.org/mailman/listinfo/python-list

Re: Most probably a stupid question, but I still want to ask

2016-04-10 Thread Stephen Hansen
On Sun, Apr 10, 2016, at 10:18 PM, Rustom Mody wrote: > On Monday, April 11, 2016 at 10:17:13 AM UTC+5:30, Stephen Hansen wrote: > > On Sun, Apr 10, 2016, at 09:03 PM, Fillmore wrote: > > > and the (almost always to be avoided) use of eval() > > > > FWIW, there&#x

Re: one-element tuples

2016-04-10 Thread Stephen Hansen
th your words: code is good, show code, don't get me wrong, but you need to express your expectations and how the difference between what happened and what you expected surprised you. Both parts, the code and the expression of your thoughts, are really important to getting help around here :)

Re: Most probably a stupid question, but I still want to ask

2016-04-10 Thread Stephen Hansen
ile multiples will return a tuple, but how you're doing that (checking the type of the result) is fine. --Stephen m e @ i x o k a i . i o -- https://mail.python.org/mailman/listinfo/python-list

Re: one-element tuples

2016-04-10 Thread Stephen Hansen
en: >>> a = '"string1",' Note the trailing comma. > I can tell you that it exists because it bit me in the butt today... > > and mind you, I am not saying that this is wrong. I'm just saying that it > surprised me. If the above doesn't explain it, then I still don't understand what you're finding surprising and what you'd expect otherwise. ---Stephen m e @ i x o k a i . i o -- https://mail.python.org/mailman/listinfo/python-list

Re: Parens do create a tuple (was: one-element tuples [Was: Most probably a stupid question, but I still want to ask])

2016-04-10 Thread Stephen Hansen
at I should have mentioned the empty tuple exception that proves the rule. The only time you need parens is to resolve ambiguity. To suggest that parens do make tuples confuses the issue, given things like this: >>> a = 1,2,3 >>> b = (1, 2, 3) -- Stephen Hansen m e @ i x o k a

Re: Most probably a stupid question, but I still want to ask

2016-04-10 Thread Stephen Hansen
On Sun, Apr 10, 2016, at 05:17 PM, Fillmore wrote: > On 04/10/2016 07:30 PM, Stephen Hansen wrote: > > > There's nothing inconsistent or surprising going on besides you doing > > something vaguely weird and not really expressing what you find > > surprising.

Re: one-element tuples [Was: Most probably a stupid question, but I still want to ask]

2016-04-10 Thread Stephen Hansen
On Sun, Apr 10, 2016, at 05:22 PM, Fillmore wrote: > Hold on a sec! it turns up that there is such thing as single-element > tuples in python: > > >>> c = ('hello',) > >>> c > ('hello',) > >>> c[0] > 'hello' > >>> c[1] > Traceback (most recent call last): >File "", line 1, in > IndexError

Re: one-element tuples [Was: Most probably a stupid question, but I still want to ask]

2016-04-10 Thread Stephen Hansen
On Sun, Apr 10, 2016, at 05:18 PM, Stephen Hansen wrote: > The parens are optional, I always put them in because: > >>> b = "hello", Ahem, "because its easy to miss the trailing comma" is what I meant to say here. -- https://mail.python.org/mailman/listinfo/python-list

Re: one-element tuples [Was: Most probably a stupid question, but I still want to ask]

2016-04-10 Thread Stephen Hansen
x27;t. Your mistake is again -- parens don't make tuples, commas do. A one element tuple is: >>> b = ("hello,) The parens are optional, I always put them in because: >>> b = "hello", The parens group an expression, they don't make a type. -- Stephen Hansen m e @ i x o k a i . i o -- https://mail.python.org/mailman/listinfo/python-list

Re: Most probably a stupid question, but I still want to ask

2016-04-10 Thread Stephen Hansen
x27;re asking is why this returns a tuple, where in the first eval you got a string. The answer is because commas create tuples (not parens), so: "String1", "String2" is a tuple expression. Whereas: "String1" is a string expression. > the ques

Re: Unicode normalisation [was Re: [beginner] What's wrong?]

2016-04-09 Thread Stephen Hansen
On Sat, Apr 9, 2016, at 12:25 PM, Mark Lawrence via Python-list wrote: > Again, where is the relevance to Python in this discussion, as we're on > the main Python mailing list? Please can the moderators take this stuff > out, it is getting beyond the pale. You need to come to grip with the fact

Re: Strange range

2016-04-02 Thread Stephen Hansen
decisions against. Most code exists outside the stdlib. --- Stephen Hansen m e @ i x o k a i . i o -- https://mail.python.org/mailman/listinfo/python-list

Re: Python Array

2016-03-30 Thread Stephen Hansen
On Wed, Mar 30, 2016, at 10:34 PM, tdspe...@gmail.com wrote: > as you can see the option element was added third but is the first one > displayed. > > Is this just standard - I am using Python 3.5 The order of items in dictionaries is based on the hash value -- which while stable, should be consi

Re: Pruning with os.scandir?

2015-08-06 Thread Stephen Kennedy
eing used in its implementation. Thanks, Stephen. -- https://mail.python.org/mailman/listinfo/python-list

Pruning with os.scandir?

2015-08-06 Thread Stephen Kennedy
be a strange case). I can't see how to do this with os.scandir. I hope I am missing something? Don't make me walk the entire contents of .git, tmp and build folders please. Stephen. -- https://mail.python.org/mailman/listinfo/python-list

Re: Python.exe has stopped working

2015-06-05 Thread Stephen Hansen
On Fri, Jun 5, 2015, at 02:03 AM, Alexis Dubois wrote: > Anyone else for an idea on that? Sorry, I have no idea. Have you tried asking on the PyQT mailing list where there is likely more of a concentration of PyQT expertise? http://www.riverbankcomputing.com/mailman/listinfo/pyqt -- Step

Re: find all multiplicands and multipliers for a number

2015-04-10 Thread Stephen Tucker
Dario Alpern has written a program that uses the Elliptic Curve Method (ECM) for factorising a number. ECM is one of the _very_ fast methods for finding the prime factors of a number. He has even offered the code for his program. You could have a go at using or converting his code to do what you ar

Re: Open file in default app and exit in Windows

2015-01-28 Thread stephen . boulet
On Wednesday, January 28, 2015 at 10:07:25 AM UTC-6, Tim Golden wrote: > On 28/01/2015 15:50, stephen...@gmail.com wrote wrote: > > I am using the following to open a file in its default application in > > Windows 7: > > > > from subprocess import call > > >

Open file in default app and exit in Windows

2015-01-28 Thread stephen . boulet
I am using the following to open a file in its default application in Windows 7: from subprocess import call filename = 'my file.csv' call('"%s"' % filename, shell=True) This still leaves a python process hanging around until the launched app is closed. Any idea how to get around? -- https://m

Re: Trees

2015-01-20 Thread Stephen Hansen
On Tue, Jan 20, 2015 at 1:45 AM, Marko Rauhamaa wrote: > Terry Reedy : > > > Others have answered as to why other special-purpose > > constrained-structure trees have not been added to the stdlib. > > Ordered O(log n) mappings are not special-purpose data structures. I'd > say strings and floats

Re: [ANN] EasyGUI_Qt version 0.9

2015-01-14 Thread stephen . boulet
On Tuesday, January 13, 2015 at 8:30:13 PM UTC, André Roberge wrote: > On Tuesday, 13 January 2015 08:23:30 UTC-4, stephen...@gmail.com wrote: > > I found a solution that I'm happy with. > > > > from datetime import datetime > > from easygui_qt import

Help understanding list operatoins inside functions in python 3

2015-01-13 Thread stephen . boulet
I'm a bit confused why in the second case x is not [1,2,3]: x = [] def y(): x.append(1) def z(): x = [1,2,3] y() print(x) z() print(x) Output: [1] [1] -- https://mail.python.org/mailman/listinfo/python-list

Re: [ANN] EasyGUI_Qt version 0.9

2015-01-13 Thread stephen . boulet
I found a solution that I'm happy with. from datetime import datetime from easygui_qt import * datestring = get_date() mydate = datetime.strptime(datestring, '%b %d %Y') On Saturday, January 10, 2015 at 1:02:30 AM UTC, André Roberge wrote: > On Friday, 9 January 2015 19:09

Re: Help configuring visual studio to compile python extensions

2015-01-09 Thread stephen . boulet
On Friday, January 9, 2015 at 8:58:59 AM UTC-6, stephen...@gmail.com wrote: > I've installed Microsoft Visual Studio 10.0. Here are the steps I've been > taking. > > My python version is Python 3.4.2 (v3.4.2:ab2c023a9432, Oct 6 2014, > 22:16:31) [MSC v.1600

Re: [ANN] EasyGUI_Qt version 0.9

2015-01-09 Thread stephen . boulet
On Wednesday, December 31, 2014 at 4:24:50 PM UTC-6, André Roberge wrote: > EasyGUI_Qt version 0.9 has been released. This is the first announcement > about EasyGUI_Qt on this list. > > Like the original EasyGUI (which used Tkinter), > EasyGUI_Qt seeks to provide simple GUI widgets > that can b

Re: Help configuring visual studio to compile python extensions

2015-01-09 Thread stephen . boulet
This page helped me sort everything out: http://www.falatic.com/index.php/120/a-guide-to-building-python-2-x-and-3-x-extensions-for-windows. -- https://mail.python.org/mailman/listinfo/python-list

Help configuring visual studio to compile python extensions

2015-01-09 Thread stephen . boulet
I've installed Microsoft Visual Studio 10.0. Here are the steps I've been taking. My python version is Python 3.4.2 (v3.4.2:ab2c023a9432, Oct 6 2014, 22:16:31) [MSC v.1600 64 bit (AMD64)] on win32. (Sorry for the long output.) >cd "c:\Program Files (x86)\Microsoft Visual Studio 10.0"\vc >vcva

Re: Challenge: optimizing isqrt

2014-11-26 Thread Stephen Tucker
Another _possible_ performance improvement that is staring us in the face is that 2*b could be replaced with b<<1. Given that b+b (an earlier suggestion of mine) involves two table look-ups for b, whereas b<<1 only involves one, it seems that the scope here for improvement is significant. By the w

Re: Challenge: optimizing isqrt

2014-11-23 Thread Stephen Tucker
t be used in those situations. Stephen Tucker. 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 oper

Re: Command prompt not shown when running Python script with subprocess on Windows

2014-05-27 Thread Stephen Hansen
You need to call python.exe path-to-script.py, I think, not just path-to-script.py. See sys.executable (though that depends on if you're a frozen app or not). I can't be sure though because there's no code. Show code when asking questions, it helps frame the discussion and get a better answer ;)

input() on python 2.7.5 vs 3.3.2

2013-12-12 Thread stephen . boulet
Can someone explain? Thanks. Python 3.3.2 (v3.3.2:d047928ae3f6, May 16 2013, 00:06:53) [MSC v.1600 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> x = input() Hello there >>> print(x) Hello there Python 2.7.5 (default, May 15 2013, 22:43:36) [M

Re: Unicode Objects in Tuples

2013-10-11 Thread Stephen Tucker
e "non-geekiness" of a string is, itself, far too geeky for my liking. The distinction seems to be an utterly spurious - even artificial or arbitrary one to me. (Sorry about the rant.) On Fri, Oct 11, 2013 at 10:22 AM, Ned Batchelder wrote: > On 10/11/13 4:16 AM, Stephen Tucker wro

Unicode Objects in Tuples

2013-10-11 Thread Stephen Tucker
objects in tuples get their characters sent to the file as escape sequences. Why is this the case? 4. As for question 1 above, I ask here also: What is the neatest way to get round this? Stephen Tucker. -- https://mail.python.org/mailman/listinfo/python-list

Re: Stripping characters from windows clipboard with win32clipboard from excel

2013-09-18 Thread stephen . boulet
Thanks to everyone for their help. Using everyone's suggestions, this seems to work: import win32clipboard, win32con def getclipboard(): win32clipboard.OpenClipboard() s = win32clipboard.GetClipboardData(win32con.CF_UNICODETEXT) win32clipboard.CloseClipboard() if '\0' in s:

Re: Stripping characters from windows clipboard with win32clipboard from excel

2013-09-17 Thread stephen . boulet
On Thursday, September 12, 2013 6:01:20 PM UTC-5, stephen...@gmail.com wrote: > I have an excel file. When I select cells, copy from excel, and then use > win32clipboard to get the contents of the clipboard, I have a 131071 > character string. > > > > When I save the fil

Re: Stripping characters from windows clipboard with win32clipboard from excel

2013-09-13 Thread stephen . boulet
On Friday, September 13, 2013 9:31:45 AM UTC-5, stephen...@gmail.com wrote: > On Thursday, September 12, 2013 10:43:46 PM UTC-5, Neil Hodgson wrote: > > > Stephen Boulet: > > > > > > > > > > > > > From the clipboard contents copied f

Re: Stripping characters from windows clipboard with win32clipboard from excel

2013-09-13 Thread stephen . boulet
On Thursday, September 12, 2013 10:43:46 PM UTC-5, Neil Hodgson wrote: > Stephen Boulet: > > > > > From the clipboard contents copied from the spreadsheet, the characters > > s[:80684] were the visible cell contents, and s[80684:] all started with > > "

Re: Stripping characters from windows clipboard with win32clipboard from excel

2013-09-12 Thread stephen . boulet
Hi Steven. Here is my code: import win32clipboard, win32con def getclipboard(): win32clipboard.OpenClipboard() s = win32clipboard.GetClipboardData(win32con.CF_TEXT) win32clipboard.CloseClipboard() return s I use this helper function to grab the text on the clipboard and do useful

Stripping characters from windows clipboard with win32clipboard from excel

2013-09-12 Thread stephen . boulet
I have an excel file. When I select cells, copy from excel, and then use win32clipboard to get the contents of the clipboard, I have a 131071 character string. When I save the file as a text file, and use the python 3.3 open command to read its contents, I only have 80684 characters. Excel (an

multiprocessing help

2012-11-06 Thread Stephen Bunn
t want to say all processes that spawned from here $@%@$% DIE. Thanks in advance for anybody that has some spare time to point me in the right direction. I am grateful. Thanks. Very Respectfully, Stephen Bunn scb...@sbunn.org sqlimport.py Description: Binary data daemon.py Description: Binary

Re: git_revision issues with scipy/numpy/matplotlib

2012-07-07 Thread Stephen Webb
I think the easiest thing to do would be to remove the python.org Python entirely, kill it from the path (which I've already done), and install directly a MacPorts version of Python. Any caveats or warnings about getting rid of the /Library/Frameworks/Python directory? On Jul 7, 2012, at J

git_revision issues with scipy/numpy/matplotlib

2012-07-06 Thread Stephen Webb
I installed py27-numpy / scipy / matplotlib using macports, and it ran without failing. When I run Python I get the following error: $>> which python /Library/Frameworks/Python.framework/Versions/2.7/bin/python $>> python Python 2.7.3 (v2.7.3:70274d53c1dd, Apr 9 2012, 20:52:43) [GCC 4.2.1 (

Embedding Python27 in C++ on Windows: CRT compatibility issues with VS2010?

2012-05-24 Thread Stephen Lin
but should use VS2008 instead, or are there other workarounds? Thanks for the help, Stephen -- http://mail.python.org/mailman/listinfo/python-list

Re: Both Python 2.5.2 and 2.7.2 flop the same way under Win 7

2011-11-18 Thread Stephen Hansen
e it has nothing to do with 32 or 64-bitness at all and my guess is wrong. Maybe your profile has gone wonky. But it doesn't matter. You can add the Edit association yourself. Its a one-time fix. -- Stephen Hansen ... Also: Ixokai ... Mail: me+list/python (AT) ixokai (DOT) io .

Re: Suggested coding style

2011-10-03 Thread Stephen Hansen
ople can use to accomplish simple, fairly common needs. -- Stephen Hansen ... Also: Ixokai ... Mail: me+list/python (AT) ixokai (DOT) io ... Blog: http://meh.ixokai.io/ signature.asc Description: OpenPGP digital signature -- http://mail.python.org/mailman/listinfo/python-list

Re: Need help with simple OOP Python question

2011-09-05 Thread Stephen Hansen
is single "sub" dictionary with all instances of your A class. If you want to define instance-specific attributes, define them in the __init__ method, like so: class A: def __init__(self): self.sub = dict() def sub_add(self, cls): obj = cls() self.sub[o

Re: [Python-ideas] allow line break at operators

2011-09-03 Thread Stephen Hansen
ke it worth the complication. -- Stephen Hansen ... Also: Ixokai ... Mail: me+list/python (AT) ixokai (DOT) io ... Blog: http://meh.ixokai.io/ * Obvious exaggeration :P signature.asc Description: OpenPGP digital signature -- http://mail.python.org/mailman/listinfo/python-list

Re: [Python-ideas] allow line break at operators

2011-09-02 Thread Stephen J. Turnbull
Yingjie Lan writes: > Have you considered line continuation by indentation? It seems to > meet the design principle. I think it is the most natural way to > allow free line breaking in Python. Briefly, yes, and I think it would need a lot of tuning and probably complex rules. Unlike statement

Re: [Python-ideas] allow line break at operators

2011-09-02 Thread Stephen J. Turnbull
Guido van Rossum writes: > On Fri, Sep 2, 2011 at 12:28 AM, Stephen J. Turnbull > wrote: > > Sure, but IIRC one design principle of Python is that the keyword that > > denotes the syntax should be the first thing on the line, [...] > That's true for *statement

Re: [Python-ideas] allow line break at operators

2011-09-02 Thread Stephen J. Turnbull
Gabriel AHTUNE writes: > So can be done with this syntax: > > > x = firstpart * secondpart + #line breaks here > > anotherpart + #continue > > stillanother #continue on. > > after a "+" operator the line is clearly not finished yet. Sure, but IIRC one design principle of Python is that

Re: Detecting Ctrl-Alt-Del in Windows

2011-09-02 Thread Stephen Hansen
ole point of that secure sequence is that the OS and only the OS responds. -- Stephen Hansen ... Also: Ixokai ... Mail: me+list/python (AT) ixokai (DOT) io ... Blog: http://meh.ixokai.io/ signature.asc Description: OpenPGP digital signature -- http://mail.python.org/mailman/listinfo/python-list

Re: Threads in Python

2011-09-01 Thread Stephen Hansen
arty module; Twisted's asynch dispatching isn't really exactly concurrency, but it does a better job then concurrency does for some operations; someone's always working on coroutines in some fashion or another, which is another kind of concurrency.) Lots of different ways to go concurren

Re: Web hosting when you need to install your own modules (was Re: Interact with SQL Database using Python 2.4 or lower)

2011-08-28 Thread Stephen Hansen
around that a long time ago, and now always keep the jobs of managing my DNS record and hosting my sites /totally/ separate. -- Stephen Hansen ... Also: Ixokai ... Mail: me+list/python (AT) ixokai (DOT) io ... Blog: http://meh.ixokai.io/ signature.asc Description: OpenPGP digital

Re: Interact with SQL Database using Python 2.4 or lower

2011-08-28 Thread Stephen Hansen
On 8/28/11 10:23 PM, Chris Angelico wrote: > On Mon, Aug 29, 2011 at 3:09 PM, Stephen Hansen > wrote: >> Get a new webhost. ... >> >> But I don't know if they have a warehouse in Australia, if their latency >> with any of their various data centers is suitable

Re: Interact with SQL Database using Python 2.4 or lower

2011-08-28 Thread Stephen Hansen
and are fairly competitive. -- Stephen Hansen ... Also: Ixokai ... Mail: me+list/python (AT) ixokai (DOT) io ... Blog: http://meh.ixokai.io/ signature.asc Description: OpenPGP digital signature -- http://mail.python.org/mailman/listinfo/python-list

Re: Understanding .pth in site-packages

2011-08-27 Thread Stephen Hansen
event people from seeing the code*, they're just regular zip files and can be unzipped fine. I almost always install unzip my eggs on a developer machine, because I inevitably want to go poke inside and see what's actually going on. -- Stephen Hansen ... Also: Ixokai ... M

Re: Arrange files according to a text file

2011-08-27 Thread Stephen Hansen
= max(ratios) > owner = usernames[ratios.index(best)] > print filename,":",owner It amazes me that I can still find a surprising new tool in the stdlib after all these years. Neat. /pinboards -- Stephen Hansen ... Also: Ixokai ... Mail: me+list/python (

Re: is there any principle when writing python function

2011-08-27 Thread Stephen Hansen
t. The entire idea that its hard, time-consuming, effort-draining or difficult to make code clean and "pretty" from the get-go is just wrong. You don't need to do a major "prettying up" stage after the fact. Sure, sometimes refactoring would greatly help a body of code as

Re: Run time default arguments

2011-08-27 Thread Stephen Hansen
t;? That's a kind of odd thing to do, I think. In Python at least. Why not just: debug = defaults.get("debug", None) (Strictly speaking, providing None to get is not needed, but I always feel odd leaving it off.) That's generally how I spell it when I need to do run tim

Re: Windows No-Install Distribution?

2011-08-23 Thread Stephen Hansen
nience of customers who want to auto-install via Group Policy). In most situations, Python's good at "finding itself", i.e. where the python.exe is actually located -- and it boostraps the location of everything else based on that. -- Stephen Hansen ... Also: Ixokai

Re: Error when deleting and reimporting subpackages

2011-08-22 Thread Stephen Hansen
On Mon, Aug 22, 2011 at 12:14 PM, Matthew Brett wrote: > Yes, sorry, I should have mentioned that I explored these kind of > variations. > > I think I see that there isn't an obvious way for del sys.modules['apkg'] > to know to delete or modify 'apkg.subpkg', because sys.modules is just a > dict.

Re: Error when deleting and reimporting subpackages

2011-08-22 Thread Stephen Hansen
you'll be able to re-import apkg.subpkg. I.e: Python 2.7.1 (r271:86882M, Nov 30 2010, 10:35:34) [GCC 4.2.1 (Apple Inc. build 5664)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import sys >>>

Re: questions (& answers) about object, type, builtin types, class, metaclass and __getattribute__

2011-08-22 Thread Stephen Hansen
ject (but NOT in the case of __*__ methods, usually, which are obtained internally by a direct struct access, i.e., mytype->tp_new gets mytype.__new__). If no such attribute exists, it goes along to do its default attribute-resolution process, including the descriptor protocol and dict checkin

Re: relative speed of incremention syntaxes (or "i=i+1" VS "i+=1")

2011-08-21 Thread Stephen Hansen
On 8/21/11 9:37 PM, Stephen Hansen wrote: > But, += is Python itself adding an unpredictable behavior into the core > language, with its own base types behaving ... very differently to fundamental, basic appearing operators. Editing fail on my part. Similarly: > But for Python, all

Re: relative speed of incremention syntaxes (or "i=i+1" VS "i+=1")

2011-08-21 Thread Stephen Hansen
ecause my criticism isn't about one choosing to do crazy stuff with the object model. I've never advocated Python be strict about rules. But for Python, all by itself, with nothing but built-in and basic types, to have a situation where: a = a + b a += b ... does two very dis

Re: relative speed of incremention syntaxes (or "i=i+1" VS "i+=1")

2011-08-21 Thread Stephen Hansen
and generally thought of as merely syntactical sugar for: n = n + x ... lets one easily think that this should be entirely safe, even with mutable objects, because if += were merely syntactical sugar, it would be. But its not! Because += is wiggly. It can do more then one entirely differe

Re: try... except with unknown error types

2011-08-19 Thread Stephen Hansen
lar bit of code must not, under any circumstances, not ultimately work. Even going so far as to start having hour long waits between retries until the other side is finally up :P) -- Stephen Hansen ... Also: Ixokai ... Mail: me+list/python (AT) ixokai (DOT) io ... Blog: http

Re: Windows service in production?

2011-08-18 Thread Stephen Hansen
ce" application we use in our company instead. It runs as a service, and executes any random series of programs beneath it, creating JOB's for each so any subprocesses of they launch all get killed together cleanly, and handling dependencies via between them through various means, and stuff

Re: running multiple scripts -- which way is more elegant?

2011-06-20 Thread Stephen Bunn
On Mon, Jun 20, 2011 at 11:19 PM, Florencio Cano wrote: > > import config_script obviously doesn't work and __import__(config_script) > > works from the python interpreter but fails in the script (ImportError: > > Import by filename is not supported.) > > You can use this: > > exec("import " + mod

Re: running multiple scripts -- which way is more elegant?

2011-06-19 Thread Stephen Bunn
On Mon, Jun 20, 2011 at 1:26 PM, Chris Angelico wrote: > > I'd be inclined toward the second solution if I'm writing all the code > > myself > On Mon, Jun 20, 2011 at 3:21 PM, Florencio Cano wrote: > I'm with Chris, if the config_scripts are going to be implemented in > Python always, the second

running multiple scripts -- which way is more elegant?

2011-06-19 Thread Stephen Bunn
List, First I'm very new to Python. I usually do this kind of thing with shell scripts, however, I'm trying to move to using python primarily so I can learn the language. I'm attempting to write a script that will check a server for various configuration settings and report and/or change based

builtin max() and weak ordering

2011-03-03 Thread Stephen Evans
, Alexander and Paul McJones. 2009. Elements of Programming. Addison Wesley. Pages 52-53 The code below demonstrates the issue. Using the total key gives the correct result. Using the weak key returns the "incorrect" result. Tested with Python 2.7.1 and 3.1.2 (applies to 3.2) Ste

Re: Python fails on math

2011-02-22 Thread Stephen Hansen
t; classification. (That said, you'd run into problems with many entirely non-Transcendental floating point numbers that have not yet meditated enough to reach nirvana-- but still). -- Stephen Hansen ... Also: Ixokai ... Mail: me+list/python (AT) ixokai (DOT) io ... Blog:

Re: Python-os. Command Execution

2011-02-19 Thread Stephen Hansen
going WRONG with your program. You said GUI, and perhaps that's the problem? If you are calling a unix interactive command line program from within a GUI context, things are quite likely to go wrong unless you do a lot of extra work. Are you expecting a new console window to pop up for '

Re: Problems of Symbol Congestion in Computer Languages

2011-02-18 Thread Stephen Hansen
not years ago, Tyler. There's really nothing more to say about it. He doesn't get it. -- Stephen Hansen ... Also: Ixokai ... Mail: me+list/python (AT) ixokai (DOT) io ... Blog: http://meh.ixokai.io/ signature.asc Description: OpenPGP digital signature -- http://mail.python.org/mailman/listinfo/python-list

Re: Easy function, please help.

2011-02-11 Thread Stephen Hansen
I'm saying (while utterly proving his inability to read basic English), and righteous indignation about how bad I am as one of the Evil Ones of python-list. Doing... bad things. Badly. Because, I, er, am, bad. Bad. BAD. CUZ. RICK. SAYS. SO. -- Stephen Hansen ... Also:

Re: Problem with giant font sizes in tkinter

2011-02-11 Thread Stephen Hansen
ajority, to declare you the spokesman for all that is holy and proper and good, none of which can be found here. Now.. this? Lol. Time to change your name. You're no longer Ranting Rick. Congratulations! You're now Blabbering Rick. -- Stephen Hansen ... Also: Ixokai

Re: [python-list] - what do you think ?

2011-02-09 Thread Stephen Hansen
On 2/9/11 12:36 AM, Stephen Hansen wrote: > .. yeah, no. Okay, I actually have to apologize for the tone of this message. It was late and I was a jerk. I could have just been helpful without including the jerk, but something about it set me off. So the helpful and the jerk got mixed in toget

<    1   2   3   4   5   6   7   8   9   10   >