Re: Continuing indentation

2016-03-02 Thread Tim Chase
On 2016-03-03 08:29, Ben Finney wrote: > Skip Montanaro writes: >> Running flake8 over some code which has if statements with >> multiple conditions like this: >> >> if (some_condition and >> some_other_condition and >> some_final_condition): >> play_bingo() > > For th

Re: A mistake which almost went me mad

2016-03-03 Thread Tim Golden
On 03/03/2016 10:43, Nick Sarbicki wrote: > On Thu, Mar 3, 2016 at 10:26 AM ast wrote: > >> Hello >> >> This has to be told >> >> I created a file pickle.py >> > > You could stop there. > > The number of times I've had to correct a student for naming their script > "turtle.py". A few teachers

Re: A mistake which almost went me mad

2016-03-03 Thread Tim Chase
On 2016-03-03 10:43, Nick Sarbicki wrote: > The number of times I've had to correct a student for naming their > script "turtle.py". > > And the number of times I've caught myself doing it... I'm surprised at the number of times I find myself creating an "email.py" DESPITE KNOWING BETTER EVERY SI

Re: A mistake which almost went me mad

2016-03-03 Thread Tim Chase
On 2016-03-03 16:29, Oscar Benjamin wrote: > On 3 March 2016 at 11:48, Tim Chase > wrote: > > On 2016-03-03 10:43, Nick Sarbicki wrote: > >> The number of times I've had to correct a student for naming > >> their script "turtle.py". > >> &g

Re: creating zipfile with symlinks

2016-03-04 Thread Tim Golden
On 04/03/2016 11:03, crankypuss wrote: > Larry Martell wrote: > >> I have a script that creates zip files of dirs containing symlinks. I >> was surprised to find that the zipfiles have zipped the targets of the >> links as opposed to the links themselves, which is what I wanted and >> expected. Go

Re: Continuing indentation

2016-03-04 Thread Tim Chase
On 2016-03-04 17:17, sohcahto...@gmail.com wrote: > x \ > = \ > 5 > if \ > y \ > == \ > z: > print \ > 'this is terrible' > print \ > 'but still not incorrect > > It would be terrible, still but not incorrect. And has the sociopathic benefit that the diffs make it quite clear what

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

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

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

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

Re: importing

2016-03-07 Thread Tim Golden
On 07/03/2016 15:54, Tony van der Hoff wrote: > I thought I understood this, but apparently not: > Under py3: > > 1. "import tkinter" imports the whole module into the name space. Any > access to names therein must be prefixed with the module name. > ie top = tkinter.Tk() > But tkinter.messagebox.

Re: How to get which attribute causes the AttributeError except inspecting strings?

2016-03-07 Thread Tim Golden
On 07/03/2016 16:25, Xiang Zhang wrote: > Hi, > > I know I can get the attribute name in some way, but since I just > want the attribute name when an AttributeError caused by it raised, I > really don't want to inspect the string or introduce one more layer > over getattr. I hope I can get the att

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

2016-03-09 Thread Tim Golden
On 09/03/2016 15:06, Jon Ribbens wrote: > On 2016-03-09, Steven D'Aprano wrote: >> generate the output. Without seeing the code you used, I have *no idea* how >> you could get that result. If you read the file in binary, you should get >> this: >> >> b'\xef\xbb\xbf\xe2\x82\xac\xe2\x82\xac\xe2\x82\

Public Service Announcement: planetpython.org

2016-03-09 Thread Tim Golden
For those who didn't know, we have a feed aggregator at https://planetpython.org. We're trying to clean up out-of-date or incorrect feed URLs. Planet Python config & (occasional) development happens on Github. So please check the Planet config files [1] to see if your blog is listed correctly, or

Re: Where is Python 3.6 installer for Win64?

2016-03-11 Thread Tim Golden
On 11/03/2016 19:24, Giga Image wrote: On Soruceforge, Python for Windows Extension, I noticed that they already haven a installer for Python 3.6. Where do I find Python 3.6 installer for Win64. I couldn't find it on Python.org/download page. The pywin32 crew are always ahead of the game: they

Re: How to waste computer memory?

2016-03-19 Thread Tim Golden
On 18/03/2016 18:18, sohcahto...@gmail.com wrote: On Thursday, March 17, 2016 at 7:34:46 AM UTC-7, wxjm...@gmail.com wrote: Very simple. Use Python and its (buggy) character encoding model. How to save memory? It's also very simple. Use a programming language, which handles Unicode correctly.

Re: empty clause of for loops

2016-03-19 Thread Tim Chase
On 2016-03-16 16:53, Peter Otten wrote: > > item=None > > for item in items: > > #do stuff > if item is None: > > #do something else > > I like that better now I see it. The only problem with that is if your iterable returns None as the last item: items = ["Something here", N

Re: sobering observation, python vs. perl

2016-03-19 Thread Tim Chase
On 2016-03-17 15:29, Charles T. Smith wrote: > isready = re.compile ("(.*) is ready") > relreq = re.compile (".*release_req") > for fn in sys.argv[1:]: # logfile > name tn = None > with open (fn) as fd: > for line in fd: > #match = re.match ("

Re: How to waste computer memory?

2016-03-19 Thread Tim Chase
On 2016-03-19 12:24, BartC wrote: > So a string that looks like: > > "ññ" > > can have 2**50 different representations? And occupy somewhere > between 50 and 200 bytes? Or is that 400? And moreover, they're all distinct if you don't normalize them.

Re: empty clause of for loops

2016-03-19 Thread Tim Chase
On 2016-03-16 15:29, Sven R. Kunze wrote: > I would re-use the "for-else" for this. Everything I thought I > could make use of the "-else" clause, I was disappointed I couldn't. Hmm...this must be a mind-set thing. I use the "else" clause with for/while loops fairly regularly and would be miffed

Re: retrieve key of only element in a dictionary (Python 3)

2016-03-19 Thread Tim Chase
On 2016-03-18 17:33, Fillmore wrote: > >>> d = dict() > >>> d['squib'] = "007" > >>> key = d.items()[0] I posted a similar question about 1-element-sets[1] a while back and Peter Otten & Rene Pijlman both suggested >>> s = set(["hello"]) >>> element, = s which, in your case would translate t

Re: empty clause of for loops

2016-03-19 Thread Tim Chase
On 2016-03-16 11:23, Sven R. Kunze wrote: > for x in my_iterable: > # do > empty: > # do something else > > What's the most Pythonic way of doing this? If you can len() on it, then the obvious way is if my_iterable: for x in my_iterable: do_something(x) else: somethin

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-23 Thread Tim Golden
On 23/03/2016 10:48, Chris Angelico wrote: > On Wed, Mar 23, 2016 at 9:34 PM, BartC wrote: >> Someone could be interested in cars, mechanics and performance without >> wanting to know the most Pythonic way to get from Kings Cross to Heathrow. > > But if I complain that the trek across four blocks

Re: newbie question

2016-03-24 Thread Tim Chase
On 2016-03-24 11:49, David Palao wrote: >> s = "(1, 2, 3, 4)" >> >> and I want to recover the tuple in a variable t >> >> t = (1, 2, 3, 4) >> >> how would you do ? > > Use "eval": > s = "(1, 2, 3, 4)" > t = eval(s) Using eval() has security implications. Use ast.literal_eval for safety instead:

Re: Threading is foobared?

2016-03-27 Thread Tim Golden
On 27/03/2016 07:25, Random832 wrote: On Sat, Mar 26, 2016, at 23:18, Ben Finney wrote: What you've demonstrated is that at least one host is violating communication standards by altering existing reference fields on messages in transit. The usenet gateway relays posts that originated on the m

Re: How to make Python interpreter a little more strict?

2016-03-27 Thread Tim Chase
On 2016-03-27 14:28, Steven D'Aprano wrote: > > So intrigued by this question I tried the following > > def fnc( n ): > > print "fnc called with parameter '%d'" % n > > return n > > > > for i in range(0,5): > > if i%2 == 0: > > fnc > > next > > print i > > >

Re: Useless expressions [was Re: Undefined behaviour in C]

2016-03-27 Thread Tim Chase
On 2016-03-28 12:38, Chris Angelico wrote: > I would still look askance at code that adds two things and drops > the result, though. The compiler can't discard it, but if a linter > complains, I'd support that. A DSL that requires you to do this is, > imo, poorly designed. Is it only the "*add* tw

Re: Lazy-evaluation lists/dictionaries

2014-10-26 Thread Tim Delaney
massively inefficient. > Why not put proxy objects into the list/dict? Have a look at the weakref module for an API that may be suitable for such proxy objects (if you used the same API, that would also allow you to transparently use weakrefs in your lists/dicts). Tim Delaney -- https://mail.python.org/mailman/listinfo/python-list

Re: memory, PE files, etc...

2014-10-27 Thread Tim Golden
On 27/10/2014 17:16, kiuhn...@yahoo.it wrote: > Hi! I'd like to write one or more scripts that analyze processes in > memory on Windows 7. I used to do these things in C++ by using native > Win32 API calls. How should I proceed in python? Any pointers? > psutil is definitely your friend: https

Re: [ANN] dbf v0.96 is released

2014-10-28 Thread Tim Chase
On 2014-10-28 12:53, Ethan Furman wrote: > dbf (also known as python dbase) is a module for reading/writing > dBase III, FP, VFP, and Clipper .dbf database files. It's > an ancient format that still finds lots of use Just a little note to give thanks for all the work you put into such an unglamo

Re: memory, PE files, etc...

2014-10-29 Thread Tim Golden
On 29/10/2014 02:18, Denis McMahon wrote: > On Mon, 27 Oct 2014 10:16:43 -0700, kiuhnm03 wrote: > >> I'd like to write one or more scripts that analyze processes in memory >> on Windows 7. I used to do these things in C++ by using native Win32 API >> calls. >> How should I proceed in python? Any p

Re: problem with pefile

2014-10-29 Thread Tim Golden
On 29/10/2014 13:15, gandal...@mail.com wrote: > Where is DIRECTORY_ENTRY_LOAD_CONFIG? In the changelog > (https://code.google.com/p/pefile/) one can read: > > "Version: 1.2.10-60 > > Besides some small bugfixes in this release I've added functionality > to parse the LOAD_CONFIG data directory. N

Re: Classes

2014-11-02 Thread Tim Delaney
ultitude of uses for user interfaces, whilst other quadrilaterals are somewhat less useful. Tim Delaney -- https://mail.python.org/mailman/listinfo/python-list

Re: generating unique variable name via loops

2014-11-04 Thread Tim Chase
On 2014-11-04 05:53, Fatih Güven wrote: > > > for x in range(1,10): > > > exec("list%d = []" % x) > > > > Why would you do this? > > I have a structured and repetitive data. I want to read a .txt file > line by line and classified it to call easily. For example > employee1 has a name, a salar

Re: What is description attribute in python?

2014-11-09 Thread Tim Chase
On 2014-11-09 02:42, satishmlm...@gmail.com wrote: > What does description attribute in the following code mean? > > curs.execute('select * from people') > colnames = [desc[0] for desc in curs.description] http://legacy.python.org/dev/peps/pep-0249/#cursor-attributes -tkc -- https://mail.py

Re: A syntax question

2014-11-10 Thread Tim Chase
On 2014-11-10 20:08, Mark Lawrence wrote: > On 10/11/2014 11:31, David Palao wrote: > >> My crystal ball is currently in for repair and is not expected > >> back in the foreseeable future. > > > > Without a crystal ball, this prediction might be not well founded. > > > > Especially in the future w

Re: I love assert

2014-11-11 Thread Tim Chase
On 2014-11-11 11:40, Peter Cacioppi wrote: > I get the impression that most Pythonistas aren't as habituated > with assert statements as I am. Is that just a misimpression on my > part? I tend to use it to catch my bone-headedness rather than actual tests. I'm particularly fond of one that catche

Re: I love assert

2014-11-14 Thread Tim Chase
On 2014-11-15 12:48, Chris Angelico wrote: > conn = establish_database_connection() > try: > do_stuff() > finally: > conn.rollback() this sounds suspiciously like you'd never actually commit. Do you mean something like conn = establisth_database_connection() try: do_stuff(conn)

Re: Decorators (was: Re: I love assert)

2014-11-14 Thread Tim Chase
On 2014-11-14 18:19, Richard Riehle wrote: > Decorators are new in Python, so there are not a lot of people > using them. Um...they were introduced in 2.4 which was released in late 2004. So they've only been around for about (almost exactly) a decade. Not sure that qualifies as "new in Python"

Re: What does this line of code mean?

2014-11-16 Thread Tim Chase
On 2014-11-16 22:45, Abdul Abdul wrote: > I just came across the following line of code: > > outputfile = os.path.splitext(infile)[0] + ".jpg" > > Can you kindly explain to me what those parts mean? Have you tried them? https://docs.python.org/2/library/os.path.html#os.path.splitext This takes

Re: Python IDE.

2014-11-20 Thread Tim Chase
On 2014-11-20 21:54, Dennis Lee Bieber wrote: > VIM in one window for editing, and a bare command line for test > execution in another (I'm sure VIM probably has a way to invoke a > command line, It can be done, but (without an unofficial patch) it's modal, so most of us vi/vim users prefer to hos

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

2014-11-21 Thread Tim Chase
On 2014-11-20 19:53, Rick Johnson wrote: > FOR INSTANCE: Let's say i write a module that presents a > reusable GUI calendar widget, and then i name the module > "calender.py". > > Then Later, when i try to import *MY* GUI widget named > "calendar", i will not get *MY* calendar widget, no, i will >

Re: python 2.7 and unicode (one more time)

2014-11-21 Thread Tim Chase
On 2014-11-22 02:23, Steven D'Aprano wrote: > LATIN SMALL LETTER E > COMBINING CIRCUMFLEX ACCENT > > then my application should treat that as a single "character" and > display it as: > > LATIN SMALL LETTER E WITH CIRCUMFLEX > > which looks like this: ê > > rather than two distinct "characters"

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

2014-11-21 Thread Tim Chase
On 2014-11-21 07:52, Rick Johnson wrote: > On Friday, November 21, 2014 4:29:48 AM UTC-6, Tim Chase wrote: > > > What messed-up version of Python are you running? > > Or did you fail to test your conjecture? > > > > $ cat > calendar.py > > print(

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

2014-11-22 Thread Tim Chase
On 2014-11-22 23:25, Steven D'Aprano wrote: > Having said that, it's not fair to blame the user for shadowing > standard library modules: > > - All users start off as beginners, who may not be aware that this > is even a possibility; While it's one thing to explicitly shadow a module (creating yo

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

2014-11-22 Thread Tim Chase
On 2014-11-23 12:00, Steven D'Aprano wrote: > >> > And after all that, it would still fail if you happened to > >> > want to import both "calendar" modules into the same module. > >> > >> __path__ = [] > >> import calendar > >> __path__ = ['my/python/modules'] > >> import calendar as mycalendar

Re: "**" in python

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

Quotation Ugliness

2014-11-25 Thread Tim Daneliuk
ways to solve this, but I'm wondering if any of you geniuses have a pythonic/elegant/short algo that solves this. TIA, Tim Daneliuk tun...@tundraware.com PGP Key: http://www.tundraware.com/PGP/ -- https://mail.python.org/mailman/listinfo/python-list

Re: Quotation Ugliness

2014-11-25 Thread Tim Chase
On 2014-11-25 18:18, Tim Daneliuk wrote: > A problem for your consideration: > > We are given a tuple of delimiter string pairs to quote or comment > text, possibly over multiple lines. Something like this: > > delims = (('"', '"'), (&

Re: Quotation Ugliness

2014-11-25 Thread Tim Daneliuk
rute force :) -- -------- Tim Daneliuk tun...@tundraware.com PGP Key: http://www.tundraware.com/PGP/ -- https://mail.python.org/mailman/listinfo/python-list

Re: Quotation Ugliness

2014-11-25 Thread Tim Daneliuk
On 11/25/2014 06:40 PM, Tim Chase wrote: On 2014-11-25 18:18, Tim Daneliuk wrote: A problem for your consideration: We are given a tuple of delimiter string pairs to quote or comment text, possibly over multiple lines. Something like this: delims = (('"', '"

Re: Quotation Ugliness

2014-11-25 Thread Tim Chase
On 2014-11-25 19:20, Tim Daneliuk wrote: > > hen you find any opener, you seek its > corresponding closer, and then special-case /* to count any > additional /* and look for a */ for each one */ . > > That's more or less where I was headed. I just wanted something >

Re: Quotation Ugliness

2014-11-25 Thread Tim Daneliuk
On 11/25/2014 07:32 PM, Chris Angelico wrote: On Wed, Nov 26, 2014 at 12:18 PM, Tim Daneliuk wrote: And what should happen with mismatched quotes? do("th/*is", "and", "th*/at") Match pairs as usual, and let the remaining unterminated quote run on. Wait,

Re: Quotation Ugliness

2014-11-25 Thread Tim Daneliuk
On 11/25/2014 07:44 PM, Tim Chase wrote: On 2014-11-25 19:20, Tim Daneliuk wrote: hen you find any opener, you seek its corresponding closer, and then special-case /* to count any additional /* and look for a */ for each one */ . That's more or less where I was headed. I just w

Re: Quotation Ugliness

2014-11-25 Thread Tim Daneliuk
On 11/25/2014 07:54 PM, Ben Finney wrote: Tim Daneliuk writes: Here's the problem: Determine is the string S appears *outside* or *inside* any such quotation. This is a problem for parsing text. There is no general, simple solution. If someone tries to convince you they have one, be h

Re: Quotation Ugliness

2014-11-26 Thread Tim Chase
On 2014-11-26 00:04, Tim Daneliuk wrote: > someprog.py uname && sudo cat /etc/sudoers > > vs. > > someprog.py uname && echo "sudo cat /etc/suoders" > > > In the first instance, I need the sudo passoword, in the second I > don't. Th

Re: Quotation Ugliness

2014-11-26 Thread Tim Daneliuk
On 11/26/2014 06:56 AM, Tim Chase wrote: On 2014-11-26 00:04, Tim Daneliuk wrote: someprog.py uname && sudo cat /etc/sudoers vs. someprog.py uname && echo "sudo cat /etc/suoders" In the first instance, I need the sudo passoword, in the second I don't. This

Re: Quotation Ugliness

2014-11-26 Thread Tim Daneliuk
. Tim Daneliuk tun...@tundraware.com PGP Key: http://www.tundraware.com/PGP/ -- https://mail.python.org/mailman/listinfo/python-list

Re: Quotation Ugliness

2014-11-26 Thread Tim Daneliuk
On 11/26/2014 08:12 AM, random...@fastmail.us wrote: On Wed, Nov 26, 2014, at 01:04, Tim Daneliuk wrote: In this case, I am not trying to write a fullblown language or recover from syntax errors. Here's a usecase - I want to know whether I need to use a sudo password when the user pas

Re: Quotation Ugliness

2014-11-26 Thread Tim Chase
On 2014-11-26 15:45, Jussi Piitulainen wrote: > Tim Chase writes: > > bash$ echo // hello > > hello > > Where did the // go? The bad-copy-and-paste gremlins ate them :-o Good catch. :) -tkc -- https://mail.python.org/mailman/listinfo/python-list

Re: Quotation Ugliness

2014-11-26 Thread Tim Daneliuk
the argument. This merely will force the user to enter their sudo password if detected. If it turns out to be a false positive, no harm will be done and the password will just go unused. Thanks for the feedback. -------- Tim Da

Re: Quotation Ugliness

2014-11-26 Thread Tim Daneliuk
On 11/26/2014 09:48 AM, Chris Angelico wrote: On Thu, Nov 27, 2014 at 2:36 AM, Tim Daneliuk wrote: The more I think about this, the more I think I am just going to look for the string 'sudo' anywhere in the argument. This merely will force the user to enter their sudo password i

Re: Quotation Ugliness

2014-11-26 Thread Tim Daneliuk
On 11/26/2014 10:00 AM, random...@fastmail.us wrote: On Wed, Nov 26, 2014, at 10:55, Tim Daneliuk wrote: Nope. Password only exist in memory locally. How does it send it to the remote sudo? Over paramiko transport (ssh) and then only if it sees a custom string coming back from sudo asking

Re: Quotation Ugliness

2014-11-26 Thread Tim Daneliuk
On 11/26/2014 10:16 AM, random...@fastmail.us wrote: On Wed, Nov 26, 2014, at 11:02, Tim Daneliuk wrote: On 11/26/2014 10:00 AM, random...@fastmail.us wrote: On Wed, Nov 26, 2014, at 10:55, Tim Daneliuk wrote: Nope. Password only exist in memory locally. How does it send it to the remote

Re: Quotation Ugliness

2014-11-26 Thread Tim Daneliuk
On 11/26/2014 10:45 AM, alister wrote: On Wed, 26 Nov 2014 10:02:57 -0600, Tim Daneliuk wrote: On 11/26/2014 10:00 AM, random...@fastmail.us wrote: On Wed, Nov 26, 2014, at 10:55, Tim Daneliuk wrote: Nope. Password only exist in memory locally. How does it send it to the remote sudo

Re: Quotation Ugliness

2014-11-26 Thread Tim Chase
On 2014-11-26 08:58, Tim Daneliuk wrote: > On 11/26/2014 06:56 AM, Tim Chase wrote: > > On 2014-11-26 00:04, Tim Daneliuk wrote: > >> someprog.py uname && sudo cat /etc/sudoers > >> > >> vs. > >> > >> someprog.py uname && ech

Building a Debian/Ubuntu package from a virtualenv

2014-11-26 Thread Tim Chase
I've created a small application in a virtualenv and would like to package it up as a .deb file for distribution on various Debian/Ubuntu (and derivatives) systems. Are there any good resources documenting this process? The biggest issue involves using versions of modules installed via pip into m

Re: Setting default_factory of defaultdict to key

2014-12-01 Thread Tim Chase
On 2014-12-01 13:05, Larry Martell wrote: > Is there a way to set the default_factory of defaultdict so that > accesses to undefined keys get to set to the key? > > i.e. if d['xxx'] were accessed and there was no key 'xxx' then > d['xxx'] would get set to 'xxx' > > I know I can define a function

Re: Cherrypy - prevent browser "prefetch"?

2014-12-01 Thread Tim Chase
On 2014-12-01 11:28, Israel Brewster wrote: > I don't know if this is a cherrypy specific question (although it > will be implemented in cherrypy for sure), or more of a general > http protocol question, but when using cherrypy to serve a web app, > is there anyway to prevent browser prefetch? I'm

Re: Cherrypy - prevent browser "prefetch"?

2014-12-01 Thread Tim Chase
On 2014-12-01 22:44, Christoph M. Becker wrote: > Tim Chase wrote: > > haven't investigated recently, but I remember Django's ability to > > trigger a log-out merely via a GET was something that irked me. > > > > All this to also say that performing non-idemp

Re: Cherrypy - prevent browser "prefetch"?

2014-12-01 Thread Tim Chase
On 2014-12-01 16:50, Ned Batchelder wrote: > On 12/1/14 4:26 PM, Tim Chase wrote: >> All this to also say that performing non-idempotent actions on a >> GET request is just begging for trouble. ;-) > > This is the key point: your web application shouldn't be doing &

Re: Cherrypy - prevent browser "prefetch"?

2014-12-01 Thread Tim Chase
On 2014-12-01 13:14, Israel Brewster wrote: > On Dec 1, 2014, at 12:50 PM, Ned Batchelder >> The way to indicate to a browser that it shouldn't pre-fetch a >> URL is to make it a POST request. > > Ok, that makes sense. The only difficulty I have with that answer > is that to the best of my knowle

Re: Proposed new conditional operator: "or else"

2014-12-02 Thread Tim Chase
On 2014-12-02 11:41, Zachary Ware wrote: > On Tue, Dec 2, 2014 at 11:18 AM, Roy Smith wrote: > > Wouldn’t it be neat to write: > > > >foo == 42 or else > > > > and have that be an synonym for: > > > > assert foo == 42 > > > > :-) > > Never going to happen, but I like it! Perhaps raise >

Re: Style question: Importing modules from packages - 'from' vs 'as'

2014-12-03 Thread Tim Delaney
e disadvantage of the former is that if you *don't* want to rename, it violates DRY (don't repeat yourself). The difference is so marginal that I'd leave it to personal preference, and wouldn't pull someone up for either in a code review. Tim Delaney -- https://mail.python.org/mailman/listinfo/python-list

Re: Proposed new conditional operator: "or else"

2014-12-03 Thread Tim Chase
On 2014-12-02 23:05, Dennis Lee Bieber wrote: > > foo == 42 or else > > Has a PERL stink to it... like: foo == 42 or die This actually works in Python and I occasionally use in debugging (much like -- https://mail.python.org/mailman/listinfo/python-list

Re: Proposed new conditional operator: "or else"

2014-12-03 Thread Tim Chase
On 2014-12-02 23:05, Dennis Lee Bieber wrote: > > foo == 42 or else > > Has a PERL stink to it... like: foo == 42 or die This statement actually works in Python and I occasionally use it when debugging (in the same fashion as one might do printf() debugging in C). It raises a NameError a

ANN: 'tsshbatch' Server Automation Tool Version 1.204 Released

2014-12-05 Thread Tim Daneliuk
first statement on a command line. All instances of the string "sudo " will now force sudo password prompting and processing. That string is ignored if it appears inside single- or double quotes. - Fixed a bug that intermittently occurred during password-based auth sessions because

Re: why can't download file from linux server into local window disk c:?

2014-12-08 Thread Tim Chase
On 2014-12-08 19:11, Luuk wrote: > On 8-12-2014 18:37, ishish wrote: > >> with open(localpath, 'wb') as fl: > >> PermissionError: [Errno 13] Permission denied: 'c:' > > > > I remember gloomily (haven't used windows since ages) that newer > > Windows versions don't like users to write directly t

Re: why can't download file from linux server into local window disk c:?

2014-12-08 Thread Tim Chase
On 2014-12-08 18:46, alister wrote: > on most systems that DO have a ssh server root logins are usually > prohibited, either enable root logins (dangerous) or log in with a > user that has permissions to do what you require. if you don't have > access to the server then you need assistance from so

Re: When do default parameters get their values set?

2014-12-08 Thread Tim Chase
On 2014-12-08 14:10, bSneddon wrote: > I ran into an issue setting variables from a GUI module that > imports a back end module. My approach was wrong obviously but > what is the best way to set values in a back end module. > > #module name beTest.py > > cfg = { 'def' : 'blue'} > > def printDef

Re: why can't download file from linux server into local window disk c:

2014-12-09 Thread Tim Chase
To: alister Copy: python-list@python.org On 2014-12-08 18:46, alister wrote: > on most systems that DO have a ssh server root logins are usually > prohibited, either enable root logins (dangerous) or log in with a > user that has permissions to do what you require. if you don't have > access to

Re: why can't download file from linux server into local window disk c:

2014-12-09 Thread Tim Chase
To: Luuk Copy: python-list@python.org On 2014-12-08 19:11, Luuk wrote: > On 8-12-2014 18:37, ishish wrote: > >> with open(localpath, 'wb') as fl: > >> PermissionError: [Errno 13] Permission denied: 'c:' > > > > I remember gloomily (haven't used windows since ages) that newer > > Windows vers

Re: When do default parameters get their values set?

2014-12-09 Thread Tim Chase
To: bSneddon Copy: python-list@python.org On 2014-12-08 14:10, bSneddon wrote: > I ran into an issue setting variables from a GUI module that > imports a back end module. My approach was wrong obviously but > what is the best way to set values in a back end module. > > #module name beTest.py >

Re: Python script isn't producing text in data file

2014-12-10 Thread Tim Golden
On 11/12/2014 05:18, Steven D'Aprano wrote: (I think it is funny that the script has a Unix "hash-bang" line at the top of the script, but is written such that it will only work on Windows.) I didn't look at the code, but responding only to your comment... Since the introduction of the PEP397

Re: Hello World

2014-12-21 Thread Tim Chase
On 2014-12-22 00:20, mm0fmf wrote: > On 22/12/2014 00:10, Chris Angelico wrote: > > Level 0: Why implement your own crypto?!? > > Because people who don't understand the concepts behind > cryptography don't understand that the crypto algorithm can be open > whilst the results of applying the algor

Re: Hello World

2014-12-22 Thread Tim Chase
On 2014-12-22 19:05, MRAB wrote: > On 2014-12-22 18:51, Mark Lawrence wrote: > > I'm having wonderful thoughts of Michael Palin's favourite Python > > sketch which involved fish slapping. > > > Well, ChrisA _has_ mentioned Pike in this thread. :-) But you know he does it just for the halibut... -

Re: missing os.lchmod, os.lchflags

2014-12-24 Thread Tim Chase
On 2014-12-24 11:42, Ethan Furman wrote: > According to the docs [1] these functions should be available as of > 2.6, yet they are missing on a 2.7, 3.2, and 3.4 install (ubuntu > 12.10 and 14.04) Confirming the same absence of os.lchmod and os.lchflags in 2.7 and 3.2 on Debian Sta

Re: missing os.lchmod, os.lchflags

2014-12-24 Thread Tim Chase
On 2014-12-25 08:23, Chris Angelico wrote: >> On 2014-12-24 11:42, Ethan Furman wrote: >>> According to the docs [1] these functions should be available as >>> of 2.6, yet they are missing on a 2.7, 3.2, and 3.4 install >>> (ubuntu 12.10 and 14.04) > > http://bugs.python.org/issue7479 Indeed it d

Re: suggestions for VIN parsing

2014-12-25 Thread Tim Chase
On 2014-12-25 17:59, Vincent Davis wrote: > These are vintage motorcycles so the "VIN's" are not like modern > VIN's these are frame numbers and engine number. > I don't want to parse the page, I what a function that given a VIN > (frame or engine number) returns the year the bike was made. While

Re: suggestions for VIN parsing

2014-12-25 Thread Tim Chase
On 2014-12-25 19:58, Vincent Davis wrote: > Any comment on using pyparsing VS regex If the VIN had any sort of regular grammar (especially if it involved nesting) then pyparsing would have value. I defaulted to regexp (1) because it's available out of the box, and (2) while it might be overkill,

Re: Own network protocol

2014-12-27 Thread Tim Chase
On 2014-12-27 01:56, pfranke...@gmail.com wrote: > I am just about setting up a project with an Raspberry Pi that is > connected to some hardware via its GPIO pins. Reading the data > already works perfectly but now I want to distribute it to clients > running in the network. Hence, I have to setup

Re: smtplib not working as expected

2014-12-27 Thread Tim Chase
On 2014-12-27 14:28, Denis McMahon wrote: > On Sat, 27 Dec 2014 02:52:39 +, Juan Christian wrote: > > reply: b'550 SMTP is available only with SSL or TLS connection > > enabled.\r\n' > > reply: retcode (550); Msg: b'SMTP is available only with SSL or > > TLS connection enabled.' > > ^^ hav

Re: Own network protocol

2014-12-29 Thread Tim Chase
On 2014-12-29 00:34, pfranke...@gmail.com wrote: > Am Samstag, 27. Dezember 2014 14:19:21 UTC+1 schrieb Tim Chase: > > - do clients need to know if they missed a message? (somebody > > disconnected from the LAN for a moment) > > This would be nice indeed. At least, the us

Re: CSV Dictionary

2014-12-29 Thread Tim Chase
On 2014-12-29 16:11, JC wrote: > On Mon, 29 Dec 2014 09:47:23 -0600, Skip Montanaro wrote: > > > On Mon, Dec 29, 2014 at 9:35 AM, JC wrote: > >> How could I get the all the records? > > > > This should work: > > > > with open('x.csv','rb') as f: > > rdr = csv.DictReader(f,delimiter=',') > >

Re: CSV Dictionary

2014-12-29 Thread Tim Chase
On 2014-12-29 16:37, JC wrote: > On Mon, 29 Dec 2014 10:32:03 -0600, Skip Montanaro wrote: > > > On Mon, Dec 29, 2014 at 10:11 AM, JC > > wrote: > >> Do I have to open the file again to get 'rdr' work again? > > > > Yes, but if you want the number of records, just operate on the > > rows list, e

Re: Enumerating loggers iin logging module

2014-12-30 Thread Tim Chase
On 2014-12-30 18:42, jptechnical.co.uk wrote: > I've recently started using the logging module and wondered if > there was a way to enumerate all the Logger objects available as a > result of calls to "logging.getLogger(name)". Went through the docs > and could not spot any way of doing this. Have

Re: How do I remove/unlink wildcarded files

2015-01-02 Thread Tim Chase
On 2015-01-02 21:21, Cameron Simpson wrote: > >def unlinkFiles(): > >dirname = "/path/to/dir" > >for f in os.listdir(dirname): > >if re.match("^unix*$", f): > >os.remove(os.path.join(dirname, f)) > > That is a very expensive way to check the filename in this > particula

Re: I must be missing something obvious in installing Python 3.4.2...

2015-01-12 Thread Tim Golden
On 12/01/2015 18:02, Andrew Koenig wrote: Downloaded and installed 64-bit Python 3.4 and pywin32-219. Both installed smoothly on my 64-bit Win7 machine. I added C:\Python34 to the search path. If I launch a Windows command window and run python -m ensurepip I get the following: Ig

Re: I must be missing something obvious in installing Python 3.4.2...

2015-01-12 Thread Tim Golden
On 12/01/2015 21:45, Andrew Koenig wrote: It runs and creates a classes.txt file with 803 lines. The first few: -> '$cpfile12' -> '$crfile12' -> '$cxfile12' -> '*' -> '.$cp' -> '.$cr' -> '.$cx' -> '.386' -> '.3ds' A few lines in the middle that might be relevant: -> '.py' -> '.pyc

Re: I must be missing something obvious in installing Python 3.4.2...

2015-01-12 Thread Tim Golden
On 12/01/2015 23:12, Andrew Koenig wrote: Fixed it! The aforementioned article is correct. I downloaded the RegDelNull program mentioned in the article (http://technet.microsoft.com/en-us/sysinternals/bb897448.aspx) and ran it on hkcr, hkcu, hklm, hku, and hkcc (short for HKEY_CLASSES_ROOT, HKEY

Re: I must be missing something obvious in installing Python 3.4.2...

2015-01-13 Thread Tim Golden
On 13/01/2015 07:05, cjgoh...@gmail.com wrote: > On Monday, January 12, 2015 at 10:09:03 PM UTC-8, Tim Golden wrote: >> On 12/01/2015 23:12, Andrew Koenig wrote: >>> Fixed it! >>> >>> The aforementioned article is correct. I downloaded the RegDelNull >>&g

Re: How to "wow" someone new to Python

2015-01-16 Thread Tim Chase
On 2015-01-17 02:03, Chris Angelico wrote: > Ideally, this should be something that can be demo'd quickly and > easily, and it should be impressive without going into great details > of "and see, this is how it works on the inside". So, how would you > brag about this language? First, I agree with

<    16   17   18   19   20   21   22   23   24   25   >