Re: Ruby parens-free function calls [was Re: Accessing parent objects]

2018-03-27 Thread Stephen Hansen
might encourage the petulant little meat-heads to follow > some sensible styling rules. My god, I've been away from this list for quite awhile, but we're still entertaining this fool? -- Stephen Hansen m e @ i x o k a i . i o -- https://mail.python.org/mailman/listinfo/python-list

Re: for / while else doesn't make sense

2016-05-20 Thread Stephen Hansen
pen to it. They aren't. -- Stephen Hansen m e @ i x o k a i . i o -- https://mail.python.org/mailman/listinfo/python-list

Re: Steve D'Aprano, you're the "master". What's wrong with this concatenation statement?

2016-05-10 Thread Stephen Hansen
ot;a" "a" >>> b = "aa" Are the same. Two+ string literals are implicitly combined into one at compile time. > 'master craftswoman' my ass... Yes, you're being that. Please stop. -- Stephen Hansen m e @ i x o k a i . i o -- https://mail.python.org/mailman/listinfo/python-list

Re: What should a decorator do if an attribute already exists?

2016-05-10 Thread Stephen Hansen
r decorator should, IMHO, treat the attribute as private data, and if something else is using the same thing, something has clearly gone wrong and raising the error early and clearly is right. -- Stephen Hansen m e @ i x o k a i . i o -- https://mail.python.org/mailman/listinfo/python-list

Re: pylint woes

2016-05-08 Thread Stephen Hansen
On Sun, May 8, 2016, at 02:46 PM, DFS wrote: > On 5/8/2016 5:38 PM, Stephen Hansen wrote: > > On Sun, May 8, 2016, at 02:16 PM, DFS wrote: > >> I was surprised to see the PEP8 guide approve of: > >> > >> "Yes: if x == 4: print x, y; x, y = y, x" >

Re: pylint woes

2016-05-08 Thread Stephen Hansen
its speaking *only* about *whitespace*. ALL its saying is, "don't put spaces before commas, colons or semicolons". You can infer nothing else about it. -- Stephen Hansen m e @ i x o k a i . i o -- https://mail.python.org/mailman/listinfo/python-list

Re: pylint woes

2016-05-08 Thread Stephen Hansen
or happens. You rollback. Or correct the data. Since the data didn't go in, there should (in theory) be nothing TO commit if an error happens. Or, there should be partial data in that needs a rollback before you decide to do something else. -- Stephen Hansen m e @ i x o k a i . i o -- https://mail.pyt

Re: pylint woes

2016-05-08 Thread Stephen Hansen
may be sorta vaguely long, but its not that long. Just do it and move on. Get over whatever makes you not like it. -- Stephen Hansen m e @ i x o k a i . i o -- https://mail.python.org/mailman/listinfo/python-list

Re: pylint woes

2016-05-07 Thread Stephen Hansen
s to comment > > > if ("Please choose a state" in str(matches)): > if (var == "val" or var2 == "val2"): Gah, don't do that. You're adding meaningless noise. Especially in the first case. -- Stephen Hansen m e @ i x o k a i . i o -- https://mail.python.org/mailman/listinfo/python-list

Re: pylint woes

2016-05-07 Thread Stephen Hansen
ide: I haven't tried, but is 'names' a bad idea or illegal for the > name of a python list or variable? Nothing wrong with names. Or 'name', for that matter. Try to avoid abbreviations. -- Stephen Hansen m e @ i x o k a i . i o -- https://mail.python.org/mailman/listinfo/python-list

Re: pylint woes

2016-05-07 Thread Stephen Hansen
ist1)) and list1[j] are all indirection, when item1 is clearly (if given a better name then 'item1') something distinct you're working on. -- Stephen Hansen m e @ i x o k a i . i o -- https://mail.python.org/mailman/listinfo/python-list

Re: Pylint prefers list comprehension over filter...

2016-05-07 Thread Stephen Hansen
On Sat, May 7, 2016, at 12:17 PM, Christopher Reimer wrote: > On 5/5/2016 6:37 PM, Stephen Hansen wrote: > > On Thu, May 5, 2016, at 06:26 PM, Christopher Reimer wrote: > >> Which is one is correct (Pythonic)? Or does it matter? > > First, pylint is somewhat opinionated,

Re: pylint woes

2016-05-07 Thread Stephen Hansen
is "good" or "bad" programming habits. -- Stephen Hansen m e @ i x o k a i . i o -- https://mail.python.org/mailman/listinfo/python-list

Re: pylint woes

2016-05-07 Thread Stephen Hansen
r j in range(len(list1)): >do something with list1[j], list2[j], list3[j], etc. > > enumeration would be: > for j,item in enumerate(list1): >do something with list1[j], list2[j], list3[j], etc. > > Is there an advantage to using enumerate() here? Its cleaner, easier to read.

Re: Python is an Equal Opportunity Programming Language

2016-05-07 Thread Stephen Hansen
position. Recognizing those faults and taking corrective action is fundamentally an act in the name of equality. Correcting for inequalities can not, itself, be a purely "equal" task done in pure blindness of the contextual reality of what is going on in the world. -- Stephen Hansen m e @ i x o k a i . i o -- https://mail.python.org/mailman/listinfo/python-list

Re: Why do these statements evaluate the way they do?

2016-05-07 Thread Stephen Hansen
ke None, True or False (And consider strongly not comparing against False/True with is, but instead just 'if thing' and if its True, it passes). Otherwise, 'is' should only be used when you're comparing *object identity*. You don't need to do that usually. Only do it when it matters to you that

Re: A fun python CLI program for all to enjoy!

2016-05-07 Thread Stephen Hansen
ment clearly defines when resources should be closed, so its preferred (As I see you've adopted from other responses). But its also needed in other Python implementations which might not follow CPython's reference counting scheme. I'm not giving further feedback because MRAB caught everything I t

Re: Pylint prefers list comprehension over filter...

2016-05-05 Thread Stephen Hansen
On Thu, May 5, 2016, at 07:46 PM, Dan Sommers wrote: > On Thu, 05 May 2016 18:37:11 -0700, Stephen Hansen wrote: > > > ''.join(x for x in string if x.isupper()) > > > The difference is, both filter and your list comprehension *build a > > list* which is not need

Re: Pylint prefers list comprehension over filter...

2016-05-05 Thread Stephen Hansen
ild a list* which is not needed, and wasteful. The above skips building a list, instead returning a generator, and join pulls items out of it one at a time as it uses them. No needlessly creating a list only to use it and discard it. -- Stephen Hansen m e @ i x o k a i . i o -- https://mail.python.

Re: Whittle it on down

2016-05-05 Thread Stephen Hansen
that the *regular expression* doesn't need to be responsible for validation. > - Even if you do somehow end up with junk, there couldn't possibly be any > real consequences to that. No one said that either... > - It doesn't matter if you match too much, or to little, that just means >

Re: Whittle it on down

2016-05-05 Thread Stephen Hansen
On Thu, May 5, 2016, at 05:31 AM, DFS wrote: > You are out of your mind. Whoa, now. I might disagree with Steven D'Aprano about how to approach this problem, but there's no need to be rude. Everyone's trying to help you, after all. -- Stephen Hansen m e @ i x o k a i . i o -- ht

Re: Whittle it on down

2016-05-05 Thread Stephen Hansen
On Thu, May 5, 2016, at 10:43 AM, Steven D'Aprano wrote: > On Thu, 5 May 2016 11:32 pm, Stephen Hansen wrote: > > > On Thu, May 5, 2016, at 12:36 AM, Steven D'Aprano wrote: > >> Oh, a further thought... > >> > >> On Thursday 05 May 2016 16:46, Stephen Hanse

Re: Whittle it on down

2016-05-05 Thread Stephen Hansen
On Thu, May 5, 2016, at 12:36 AM, Steven D'Aprano wrote: > Oh, a further thought... > > On Thursday 05 May 2016 16:46, Stephen Hansen wrote: > > I don't even care about faster: Its overly complicated. Sometimes a > > regular expression really is the clearest way to solve a

Re: Whittle it on down

2016-05-05 Thread Stephen Hansen
On Thu, May 5, 2016, at 12:04 AM, Steven D'Aprano wrote: > On Thursday 05 May 2016 16:46, Stephen Hansen wrote: > > > On Wed, May 4, 2016, at 11:04 PM, Steven D'Aprano wrote: > >> Start by writing a function or a regex that will distinguish strings that > >> ma

Re: Whittle it on down

2016-05-05 Thread Stephen Hansen
dea that one shouldn't go to regex when Python's powerful string type can answer the problem more clearly, but this seems to go out of its way to do otherwise. I don't even care about faster: Its overly complicated. Sometimes a regular expression really is the clearest way to solve a problem. -- Stephe

Re: Whittle it on down

2016-05-04 Thread Stephen Hansen
t;> pattern = re.compile(r"^[A-Z\s&]+$") >>> output = [x for x in list if pattern.match(x)] >>> output ['PHYSICAL FITNESS CONSULTANTS & TRAINERS', 'HEALTH CLUBS & GYMNASIUMS', 'HEALTH CLUBS & GYMNASIUMS', 'RACQUETBALL COURTS PRIVATE', 'GYMNASIUMS', 'HEALTH & FITNESS CLUBS', 'HEALTH & FITNESS CLUBS', 'PERSONAL FITNESS TRAINERS', 'HEALTH CLUBS & GYMNASIUMS', 'EXERCISE & PHYSICAL FITNESS PROGRAMS', 'FITNESS CENTERS', 'HEALTH CLUBS & GYMNASIUMS', 'HEALTH CLUBS & GYMNASIUMS', 'PERSONAL FITNESS TRAINERS'] -- Stephen Hansen m e @ i x o k a i . i o -- https://mail.python.org/mailman/listinfo/python-list

Re: No SQLite newsgroup, so I'll ask here about SQLite, python and MS Access

2016-05-04 Thread Stephen Hansen
oup=gmane.comp.db.sqlite.general > Any ideas? Sorry, I don't use Access. -- Stephen Hansen m e @ i x o k a i . i o -- https://mail.python.org/mailman/listinfo/python-list

Re: Conditionals And Control Flows

2016-05-04 Thread Stephen Hansen
return y. In this case, "x and y" will be a true thing if y is a true thing, and a false thing if y is a false thing. As you can see, all of this logic happens without ever using True or False. -- Stephen Hansen m e @ i x o k a i . i o -- https://mail.python.org/mailman/listinfo/python-list

Re: You gotta love a 2-line python solution

2016-05-03 Thread Stephen Hansen
On Mon, May 2, 2016, at 08:57 PM, jf...@ms4.hinet.net wrote: > Stephen Hansen at 2016/5/3 11:49:22AM wrote: > > On Mon, May 2, 2016, at 08:27 PM, jf...@ms4.hinet.net wrote: > > > But when I try to get this forum page, it does get a html file but can't > > > be viewed n

Re: Saving Consol outputs in a python script

2016-05-03 Thread Stephen Hansen
utput will be a string, string has a splitlines method, etc. -- Stephen Hansen m e @ i x o k a i . i o -- https://mail.python.org/mailman/listinfo/python-list

Re: You gotta love a 2-line python solution

2016-05-02 Thread Stephen Hansen
On Mon, May 2, 2016, at 08:27 PM, jf...@ms4.hinet.net wrote: > But when I try to get this forum page, it does get a html file but can't > be viewed normally. What does that mean? -- Stephen Hansen m e @ i x o k a i . i o -- https://mail.python.org/mailman/listinfo/python-list

Re: Best way to clean up list items?

2016-05-02 Thread Stephen Hansen
On Mon, May 2, 2016, at 11:09 AM, DFS wrote: > I'd prefer to get clean data in the first place, but I don't know a > better way to extract it from the HTML. Ah, right. I didn't know you were scraping HTML. Scraping HTML is rarely clean so you have to do a lot of cleanup. -- Stephen Hans

Re: Python3 html scraper that supports javascript

2016-05-02 Thread Stephen Hansen
laylist.m3u8?foo=bar;> > > > but I can't come to that point. Why? As important as it is to show code, you need to show what actually happens and what error message is produced. -- Stephen Hansen m e @ i x o k a i . i o -- https://mail.python.org/mailman/listinfo/python-list

Re: Best way to clean up list items?

2016-05-02 Thread Stephen Hansen
1 if t and not t.isspace()] -- Stephen Hansen m e @ i x o k a i . i o -- https://mail.python.org/mailman/listinfo/python-list

Re: Fastest way to retrieve and write html contents to file

2016-05-02 Thread Stephen Hansen
On Mon, May 2, 2016, at 12:37 AM, DFS wrote: > On 5/2/2016 2:27 AM, Stephen Hansen wrote: > > I'm again going back to the point of: its fast enough. When comparing > > two small numbers, "twice as slow" is meaningless. > > Speed is always meaningful. >

Re: Fastest way to retrieve and write html contents to file

2016-05-02 Thread Stephen Hansen
at which point the difference is irrelevant. If you believe otherwise, demonstrate it. -- Stephen Hansen m e @ i x o k a i . i o -- https://mail.python.org/mailman/listinfo/python-list

Re: You gotta love a 2-line python solution

2016-05-01 Thread Stephen Hansen
lretrieve(webpage,webfile) WORKS > > webfile = "rD:\econpy001.html" The r is *outside* the string. Its: r"D:\econpy001.html" -- Stephen Hansen m e @ i x o k a i . i o -- https://mail.python.org/mailman/listinfo/python-list

Re: Code Opinion - Enumerate

2016-05-01 Thread Stephen Hansen
uch noise to it, but in general: Using enumerate increases readability, and I use it whenever the idiom: for index, item in enumerate(thing): ... is used. Enumerate is your friend. Hug it. -- Stephen Hansen m e @ i x o k a i . i o -- https://mail.python.org/mailman/listinfo/python-list

Re: You gotta love a 2-line python solution

2016-05-01 Thread Stephen Hansen
On Sun, May 1, 2016, at 10:08 PM, DFS wrote: > On 5/2/2016 1:02 AM, Stephen Hansen wrote: > >> I actually use "D:\\file.html" in my code. > > > > Or you can do that. But the whole point of raw strings is not having to > > escape slashes :) > > >

Re: Fastest way to retrieve and write html contents to file

2016-05-01 Thread Stephen Hansen
n't shown that. -- Stephen Hansen m e @ i x o k a i . i o -- https://mail.python.org/mailman/listinfo/python-list

Re: Fastest way to retrieve and write html contents to file

2016-05-01 Thread Stephen Hansen
ib2.urlopen(webpage); f = open(filename, 'w'); f.write(r.read()); f.close();" 10 loops, best of 3: 175 msec per loop That's a whole lot less the 0.88secs. -- Stephen Hansen m e @ i x o k a i . i o -- https://mail.python.org/mailman/listinfo/python-list

Re: Fastest way to retrieve and write html contents to file

2016-05-01 Thread Stephen Hansen
On Sun, May 1, 2016, at 09:50 PM, DFS wrote: > On 5/2/2016 12:40 AM, Chris Angelico wrote: > > On Mon, May 2, 2016 at 2:34 PM, Stephen Hansen <me+pyt...@ixokai.io> wrote: > >> On Sun, May 1, 2016, at 09:06 PM, DFS wrote: > >>> Then I tested them in loops - the

Re: You gotta love a 2-line python solution

2016-05-01 Thread Stephen Hansen
On Sun, May 1, 2016, at 09:51 PM, DFS wrote: > On 5/2/2016 12:31 AM, Stephen Hansen wrote: > > On Sun, May 1, 2016, at 08:39 PM, DFS wrote: > >> To save a webpage to a file: > >> - > >> 1. import url

Re: Fastest way to retrieve and write html contents to file

2016-05-01 Thread Stephen Hansen
fast enough for you? That's less then a second. -- Stephen Hansen m e @ i x o k a i . i o -- https://mail.python.org/mailman/listinfo/python-list

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.

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

2016-04-30 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*, > > you ru

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

2016-04-29 Thread Stephen Hansen
/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 <m...@ixokai.io> writes: > > > On Wed, Apr 27, 2016, at 10:32 PM, Ben Finney wrote: > > > Better: when you have many semantically-different values, use named > > > (not positio

Re: Python Madlibs.py code and error message

2016-04-28 Thread Stephen Hansen
On Wed, Apr 27, 2016, at 10:32 PM, Ben Finney wrote: > Stephen Hansen <me+pyt...@ixokai.io> 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 t

Re: Python Madlibs.py code and error message

2016-04-27 Thread Stephen Hansen
ing. 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
un4) 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
cebacks. 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
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 Pythoni

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

2016-04-21 Thread Stephen Hansen
On Thu, Apr 21, 2016, at 06:34 PM, Christopher Reimer wrote: > class PieceFactory(object): > > def factory(color, piece, position): > if piece == 'Bishop': > return Bishop(color, position) > if piece == 'King': > return

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

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-20 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 > > needed. > > Yea

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

2016-04-19 Thread Stephen Hansen
On Sun, Apr 17, 2016, at 12:34 PM, Christopher Reimer wrote: > if color not in [VARS['COLOR_BLACK'], VARS['COLOR_WHITE']]: > raise Exception("Require \'{}\' or \'{}\' for input value, got > \'{}\' instead.".format(VARS['COLOR_BLACK'], VARS['COLOR_WHITE'], color)) Do you think it

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
and represent 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-16 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

Re: How to XOR a byte output?

2016-04-13 Thread Stephen Hansen
On Wed, Apr 13, 2016, at 06:51 AM, durgadevi1 wrote: > I would like to check with you whether using binascii.hexlify() to > convert the series of bytes into alphabets and integers is correct. To be clear, they already are integers.The \x notation is how you naively represent a byte out of the

Re: hourly weather forecast data

2016-04-13 Thread Stephen Hansen
fetch 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-13 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's

Re: one-element tuples

2016-04-10 Thread Stephen Hansen
rds: 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 :) --- Stephen Han

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

2016-04-10 Thread Stephen Hansen
On Sun, Apr 10, 2016, at 09:03 PM, Fillmore wrote: > and the (almost always to be avoided) use of eval() FWIW, there's ast.literal_eval which is safe and there's no reason to avoid it. You'll still have to deal with the fact that a single string on a line will return a string while multiples will

Re: one-element tuples

2016-04-10 Thread Stephen Hansen
On Sun, Apr 10, 2016, at 05:48 PM, Fillmore wrote: > On 04/10/2016 08:31 PM, Ben Finney wrote: > > Can you describe explicitly what that “discontinuation point” is? I'm > > not seeing it. > > Here you go: > > >>> a = '"string1"' Here, "a" is a string that contains a double quoted string. So if

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
tioned 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 i . i o -- https:

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 >

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
as 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
On Sun, Apr 10, 2016, at 03:51 PM, Fillmore wrote: > > let's look at this: > > $ python3.4 > Python 3.4.0 (default, Apr 11 2014, 13:05:11) > [GCC 4.8.2] on linux > Type "help", "copyright", "credits" or "license" for more information. > >>> line1 = '"String1" | bla' > >>> parts1 =

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

Re: Strange range

2016-04-03 Thread Stephen Hansen
ost 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

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 -- Stephen

Re: Trees

2015-01-20 Thread Stephen Hansen
On Tue, Jan 20, 2015 at 1:45 AM, Marko Rauhamaa ma...@pacujo.net wrote: Terry Reedy tjre...@udel.edu: 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

[issue4431] Distutils MSVC doesn't create manifest file

2015-01-02 Thread Stephen Hansen
Stephen Hansen added the comment: Just to be clear, I ran into this exact issue recently in VS2010 professional as I indicated earlier. I don't know about what should or should not be needed, but the solution in the original comment fixed it exactly for me

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 ;)

[issue4431] Distutils MSVC doesn't create manifest file

2014-02-14 Thread Stephen Hansen
Stephen Hansen added the comment: FYI. Windows 8.1, Visual Studio 2010 SP1 Pro just installed, Python 3.3.3; a random extension did this as a 'test' in its setup.py: compiler = distutils.ccompiler.new_compiler() if not compiler.has_function('rand', includes = ['stdlib.h

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

2011-11-18 Thread Stephen Hansen
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 ... Blog: http://meh.ixokai.io/ signature.asc Description: OpenPGP digital signature -- http://mail.python.org/mailman/listinfo

Re: Suggested coding style

2011-10-04 Thread Stephen Hansen
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
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[obj.id] = obj -- Stephen Hansen ... Also

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

2011-09-03 Thread Stephen Hansen
. -- 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: Detecting Ctrl-Alt-Del in Windows

2011-09-02 Thread Stephen Hansen
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
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 concurrent, depending on your needs. -- Stephen Hansen ... Also: Ixokai ... Mail: me+list/python (AT) ixokai (DOT) io ... Blog

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-29 Thread Stephen Hansen
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 signature -- http

Re: Interact with SQL Database using Python 2.4 or lower

2011-08-28 Thread Stephen Hansen
. But I don't know if they have a warehouse in Australia, if their latency with any of their various data centers is suitable for you. Maybe, maybe not -- but there /has/ to be a better option then this site... Good hosts these days are not all that uncommon and are fairly competitive. -- Stephen

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 me+list/pyt...@ixokai.io 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 for you. Maybe, maybe

Re: Run time default arguments

2011-08-27 Thread Stephen Hansen
generally how I spell it when I need to do run time defaults. -- 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: is there any principle when writing python function

2011-08-27 Thread Stephen Hansen
help a body of code as it evolves, but you can do that as it becomes beneficial for maintenance reasons and not just for pretty's sake. -- Stephen Hansen ... Also: Ixokai ... Mail: me+list/python (AT) ixokai (DOT) io ... Blog: http://meh.ixokai.io/ signature.asc Description: OpenPGP

Re: Arrange files according to a text file

2011-08-27 Thread Stephen Hansen
[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 (AT) ixokai (DOT) io ... Blog: http://meh.ixokai.io/ signature.asc

Re: Understanding .pth in site-packages

2011-08-27 Thread Stephen Hansen
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 ... Mail: me+list/python (AT) ixokai (DOT) io ... Blog: http

Re: Windows No-Install Distribution?

2011-08-23 Thread Stephen Hansen
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 ... Mail: me+list/python (AT) ixokai (DOT) io

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

2011-08-22 Thread Stephen Hansen
of the attributes name. If so, call that. - Check to see if the object's instance dict has an attribute of the name. If so, return that. - Check to see if the object's base-classes have an attribute of the name. More or less. I think. I'm probably leaving something out there. -- Stephen

Re: Error when deleting and reimporting subpackages

2011-08-22 Thread Stephen Hansen
del sys.modules['test1'] del sys.modules['test1.test2'] import test1.test2 as test2 -- 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

  1   2   3   4   5   6   7   8   >