Re: Irregular last line in a text file, was Re: Regular expressions

2015-11-04 Thread Tim Chase
On 2015-11-04 14:39, Steven D'Aprano wrote: > On Wednesday 04 November 2015 03:56, Tim Chase wrote: >> Or even more valuable to me: >> >> with open(..., newline="strip") as f: >> assert all(not line.endswith(("\n", "\r")) for l

Re: Regular expressions

2015-11-04 Thread Tim Chase
On 2015-11-04 09:57, Peter Otten wrote: > Well, I didn't know that grep uses regular expressions by default. It doesn't help that grep(1) comes in multiple flavors: grep: should use BRE (Basic REs) fgrep: same as "grep -F"; uses fixed strings, no REs egrep: same as "grep -E"; uses ERE (Extende

Re: What does “grep” stand for? (was: Regular expressions)

2015-11-04 Thread Tim Chase
On 2015-11-05 05:24, Ben Finney wrote: > A very common command to issue, then, is “actually show me the line > of text I just specified”; the ‘p’ (for “print”) command. > > Another very common command is “find the text matching this pattern > and perform these commands on it”, which is ‘g’ (for “g

Re: Regular expressions

2015-11-04 Thread Tim Chase
On 2015-11-05 13:28, Steven D'Aprano wrote: > > I tried Tim's example > > > > $ seq 5 | grep '1*' > > 1 > > 2 > > 3 > > 4 > > 5 > > $ > > I don't understand this. What on earth is grep matching? How does > "4" match "1*"? The line with "4" matches "zero or more 1s". If it was searching for a

Re: Regular expressions

2015-11-05 Thread Tim Chase
On 2015-11-05 23:05, Steven D'Aprano wrote: > Oh the shame, I knew that. Somehow I tangled myself in a knot, > thinking that it had to be 1 *followed by* zero or more characters. > But of course it's not a glob, it's a regex. But that's a good reminder of fnmatch/glob modules too. Sometimes all y

Re: Getting response by email reply message

2015-11-09 Thread Tim Chase
On 2015-11-09 08:12, zljubi...@gmail.com wrote: > I know how to send an email, but I would like to be able to receive > a reply and act accordingly. Mail reply should contain yes/no > answer. You have a couple options that occur to me: 1) set up an SMTP server somewhere (or use the existing one y

Re: Getting response by email reply message

2015-11-09 Thread Tim Chase
On 2015-11-09 13:53, zljubi...@gmail.com wrote: > > You have a couple options that occur to me: > > > > 1) set up an SMTP server somewhere (or use the existing one you're > > receiving this email at in the event you're getting it as mail > > rather than reading it via NNTP or a web interface) to r

Using subprocess to capture a progress line

2015-11-10 Thread Tim Johnson
rogress is being shown? In my case lines being output aren't being shown unless a newline is sent, or so I understand it. FYI : the need for this function in this case is trivial, but the solution will be enlightening for me and have other uses, I'll bet. thanks -- Tim http:

Re: Using subprocess to capture a progress line

2015-11-10 Thread Tim Johnson
* Chris Angelico [151110 14:35]: > On Wed, Nov 11, 2015 at 9:47 AM, Tim Johnson wrote: > > I've written a command-line "wrapper" for youtube-dl, executing > > youtube-dl as a subprocess. > > > >

Re: Using subprocess to capture a progress line

2015-11-10 Thread Tim Johnson
* Tim Johnson [151110 14:55]: > * Chris Angelico [151110 14:35]: > > On Wed, Nov 11, 2015 at 9:47 AM, Tim Johnson wrote: > > > I've written a command-line "wrapper" for youtube-dl, executing

Re: Using subprocess to capture a progress line

2015-11-10 Thread Tim Johnson
* Tim Johnson [151110 14:55]: > * Chris Angelico [151110 14:35]: > > On Wed, Nov 11, 2015 at 9:47 AM, Tim Johnson wrote: > > > I've written a command-line "wrapper" for youtube-dl, executing > > is implemented in Python, you might find it easier to "p

Re: Using subprocess to capture a progress line

2015-11-11 Thread Tim Johnson
* Chris Warrick [15 00:55]: > On 10 November 2015 at 23:47, Tim Johnson wrote: > > Using python 2.7.6 on ubuntu 14.04 <..> > There is no \n character at the end — which means that > p.stdout.readline() cannot return. In fact, if you printed repr() of > the line you

Re: new to python, help please !!

2015-11-11 Thread Tim Chase
On 2015-11-11 08:34, Anas Belemlih wrote: > i am a beginning programmer, i am trying to write a simple code > to compare two character sets in 2 seperate files. ( 2 hash value > files basically) idea is: open both files, measure the length of > the loop on. > > if the length doesn't match, ==

Re: Using subprocess to capture a progress line

2015-11-11 Thread Tim Johnson
* Chris Warrick [15 07:54]: > On 11 November 2015 at 17:16, Tim Johnson wrote: > >> (2) [don’t do it] do you need to intercept the lines? If you don’t set > >> stderr= and stdout=, things will print just fine. > > Got to try that before using the module, just for

More tkinter Madness

2015-11-11 Thread Tim Daneliuk
I am the author of twander (https://www.tundraware.com/Software/twander). This code has run flawlessly for years on FreeBSD, Linux, MacOS and Windows. Some months ago, I put it on a couple of VPS servers (FreeBSD and Linux) and BOOM, it doesn't run. I asked around here and got some suggestions an

Re: new to python, help please !!

2015-11-12 Thread Tim Chase
On 2015-11-12 08:21, Marko Rauhamaa wrote: > And if you really wanted to compare two files that are known to > contain MD5 checksums, the simplest way is: > >with open('f1.md5') as f1, open('f2.md5') as f2: >if f1.read() == f2.read(): >... >else: >... T

Re: new to python, help please !!

2015-11-12 Thread Tim Chase
On 2015-11-12 15:56, Peter Otten wrote: > Tim Chase wrote: > > > with open("file1.md5") as a, open("file2.md5") as b: > > for s1, s2 in zip(a, b): > > if s1 != s2: > > print("Files differ") > > Note that this w

Re: can ConfigParser deal with repeating section header?

2015-11-12 Thread Tim Chase
On 2015-11-12 07:47, John Zhao wrote: > I have a configuration file with repeating sections, for example, > > [INSTANCE] > Name=a > > [INSTANCE] > Name=b > > I hope I can use ConfigParser to read the file and store the > configuration settings in arrays. > > Is that possible? Not with the s

Re: More tkinter Madness

2015-11-12 Thread Tim Daneliuk
On 11/11/2015 08:25 PM, Chris Angelico wrote: > On Thu, Nov 12, 2015 at 12:52 PM, Tim Daneliuk > wrote: >> I am the author of twander (https://www.tundraware.com/Software/twander). >> This code has run flawlessly for years on FreeBSD, Linux, MacOS and >> Windows. Some m

Re: More tkinter Madness

2015-11-12 Thread Tim Daneliuk
On 11/11/2015 08:12 PM, Paul Rubin wrote: > Tim Daneliuk writes: >> Some months ago, I put it on a couple of VPS servers (FreeBSD >> and Linux) and BOOM, it doesn't run. I asked around here and got some >> suggestions and then did some homework. > > I'd e

Re: More tkinter Madness

2015-11-12 Thread Tim Daneliuk
On 11/12/2015 10:46 PM, Michael Torrie wrote: > On 11/12/2015 05:25 PM, Tim Daneliuk wrote: >> On 11/11/2015 08:25 PM, Chris Angelico wrote: >>> On Thu, Nov 12, 2015 at 12:52 PM, Tim Daneliuk >>> wrote: >>>> I am the author of twander (https://www.tundrawar

Re: More tkinter Madness

2015-11-13 Thread Tim Daneliuk
On 11/13/2015 12:32 AM, Christian Gollwitzer wrote: > Apfelkiste:Sources chris$ Well, I get window and when I do this: pack [button .b -text Hello -command exit] Nothing appears. tkinter appears borked I have reinstalled once already, will try again -- https://mail.python.org/mailman/listin

Re: More tkinter Madness

2015-11-13 Thread Tim Daneliuk
On 11/13/2015 01:58 PM, Michael Torrie wrote: > On 11/13/2015 12:14 PM, Tim Daneliuk wrote: >> On 11/13/2015 12:32 AM, Christian Gollwitzer wrote: >>> Apfelkiste:Sources chris$ >> >> Well, I get window and when I do this: >> >> pack [button .b -text

Re: More tkinter Madness

2015-11-13 Thread Tim Daneliuk
On 11/13/2015 03:30 PM, Christian Gollwitzer wrote: > Am 13.11.15 um 20:14 schrieb Tim Daneliuk: >> On 11/13/2015 12:32 AM, Christian Gollwitzer wrote: >>> Apfelkiste:Sources chris$ >> >> Well, I get window and when I do this: >> >> pack [button .b -text

Re: More tkinter Madness

2015-11-13 Thread Tim Daneliuk
On 11/13/2015 01:56 PM, Laura Creighton wrote: > In a message of Fri, 13 Nov 2015 13:14:08 -0600, Tim Daneliuk writes: >> On 11/13/2015 12:32 AM, Christian Gollwitzer wrote: >>> Apfelkiste:Sources chris$ >> >> Well, I get window and when I do this: >> >>

Re: What is '@' for

2015-11-13 Thread Tim Daneliuk
On 11/13/2015 05:14 PM, Chris Angelico wrote: > On Sat, Nov 14, 2015 at 10:04 AM, fl wrote: >> I read the following code snippet. A question is here about '@'. >> I don't find the answer online yet. >> >> What function is it here? >> >> >> @pymc.deterministic >> def theta(a=alpha, b=beta): >>

Re: Why won't this run?

2015-11-15 Thread Tim Chase
On 2015-11-15 12:38, jbak36 wrote: > Python 3.5.0 (v3.5.0:374f501f4567, Sep 13 2015, 02:27:37) [MSC > v.1900 64 bit (AMD64)] on win32 Type "copyright", "credits" or > "license()" for more information. > >>> #this program says hello and asks for my name > >>> print:('Hello world!') > Hello world! W

Re: What meaning is 'a[0:10:2]'?

2015-11-15 Thread Tim Chase
On 2015-11-15 16:27, fl wrote: > When I learn slice, I have a new question on the help file. If I > set: > > pp=a[0:10:2] > > pp is array([1, 3]) > > I don't know how a[0:10:2] gives array([1, 3]). > > I know matlab a lot, but here it seems quite different. Could you > tell me what meaning a[0:

Re: Unicode and Python - how often do you index strings?

2014-06-06 Thread Tim Chase
On 2014-06-06 10:47, Johannes Bauer wrote: > > Personally I tend toward rstrip('\r\n') so that I don't have to > > worry about files with alternative line terminators. > > Hm, I was under the impression that Python already took care of > removing the \r at a line ending. Checking that right now: >

Re: Micro Python -- a lean and efficient implementation of Python 3

2014-06-06 Thread Tim Chase
On 2014-06-06 09:59, Travis Griggs wrote: > On Jun 4, 2014, at 4:01 AM, Tim Chase wrote: > > If you use UTF-8 for everything > > It seems to me, that increasingly other libraries (C, etc), use > utf8 as the preferred string interchange format. I definitely advocate UTF-8

Re: os.startfile hanging onto the launched app, or my IDE?

2014-06-07 Thread Tim Golden
On 06/06/2014 21:34, Josh English wrote: I have been using os.startfile(filepath) to launch files I've created in Python, mostly Excel spreadsheets, text files, or PDFs. When I run my script from my IDE, the file opens as I expect. But if I go back to my script and re-run it, the external progra

Re: os.startfile hanging onto the launched app, or my IDE?

2014-06-09 Thread Tim Golden
On 09/06/2014 23:31, Ethan Furman wrote: On 06/09/2014 03:21 PM, Josh English wrote: So this quirk is coming from PyScripter, which is a shame, because I don't think it's under development, so it won't be fixed. The nice thing about Python code is you can at least fix your copy. :) IIRC, P

Re: Micro Python -- a lean and efficient implementation of Python 3

2014-06-10 Thread Tim Delaney
oll about the FSR. Please don't reply to him (and preferably add him to your killfile). Tim Delaney -- https://mail.python.org/mailman/listinfo/python-list

Re: try/except/finally

2014-06-10 Thread Tim Delaney
on how easily their fur gets up your nose). Now, a cat *standing* on the keyboard, between you and the monitor, and rubbing his head against your hands, is a whole other matter. Tim Delaney -- https://mail.python.org/mailman/listinfo/python-list

Announcing the PyconUK Education Track

2014-06-13 Thread Tim Golden
If you're UK-based and aren't following the python-uk mailing list -- well, why aren't you? But, just in case, we're announcing the Education Track at this year's PyCon UK. See here for details: http://pyconuk.org/education/ If you're a teacher in the UK, or if you know any teachers here, this is

Re: line to argv transformation

2014-06-16 Thread Tim Chase
On 2014-06-16 20:41, Chris Angelico wrote: > Oops! I made the cardinal error of trying in one and assuming it'd > work in both. Just needs a b prefix on the split string: > > def shell_split(cmd): > return subprocess.check_output("""python -c 'import sys; > print("\\0".join(sys.argv[1:]))' > "

Re: line to argv transformation

2014-06-16 Thread Tim Chase
hlib.py to my local project under a new name and then tweak the source to emit whether a token was quoted or not, something like the diff below. You can then iterate over your string/token-stream and know whether it was quoted or not, allowing you to do any post-processing/globbing on that file

Re: PyPy3 2.3.1 released

2014-06-20 Thread Tim Delaney
Congratulations. I can't find the details of PyPy3's unicode implementation documented anywhere. Is it equivalent to: - a Python 3.2 narrow build - a Python 3.2 wide build - PEP 393 - something else? Cheers, Tim Delaney On 21 June 2014 06:32, Philip Jen

Re: Success with subprocess communicate on Windows?

2014-07-01 Thread Tim Roberts
b\\turtle.py") or s.check_output(r"pyflakes c:\programs\python34\lib\turtle.py") -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. -- https://mail.python.org/mailman/listinfo/python-list

Re: PEP8 and 4 spaces

2014-07-03 Thread Tim Chase
> Any evidence out there that this part of PEP8 is becoming > more optional or even obsolete, as I've heard others > say about the 80 char line length? > > Just need ammo for when the hammer of code > unification comes down. I'm not sure you'll get a whole lot of "PEP8 is optional or obsolete", t

Re: PEP8 and 4 spaces

2014-07-03 Thread Tim Chase
On 2014-07-03 19:02, Grant Edwards wrote: > > That may be true, but that same person is going to have a > > difficult time editing the code. > > That's true with Notepad, but with dozens of other programming > editors, code indented with spaces will read and edit prefectly. > Not so for tab-inde

Re: PEP8 and 4 spaces

2014-07-04 Thread Tim Chase
On 2014-07-05 11:17, Gregory Ewing wrote: > > PEP8 suggests using this style of method invocation: > > > > obj.method(foo, > >bar, > >baz) > > > > which is an effect impossible to do correctly with tabs alone. > > Yes, PEP 8 is self-contradictory in that reg

Re: Why is it different from the example on the tutorial?

2014-07-06 Thread Tim Chase
On 2014-07-06 05:13, rxjw...@gmail.com wrote: > What I get on Python console: > > $ python > Python 2.7.5 (default, Oct 2 2013, 22:34:09) > [GCC 4.8.1] on cygwin > Type "help", "copyright", "credits" or "license" for more > information. > >>> import re > >>> p = re.compile('ab*') > File "", lin

Re: How do you use `help` when write your code

2014-07-06 Thread Tim Chase
On 2014-07-06 17:52, Steven D'Aprano wrote: > I have a monkey-patched version of dir() which takes a second > argument, a glob, to filter the list of names returned: > > py> len(dir(os)) # Too much! > 312 > py> dir(os, 'env') > ['_putenv', '_unsetenv', 'environ', 'environb', 'getenv', > 'getenvb'

Re: open() and EOFError

2014-07-08 Thread Tim Chase
On 2014-07-08 11:08, Terry Reedy wrote: > > Indeed. Ctrl-D is _the_ canonical way to tell a program that's > > reading stdin that your're done. > > Not on Windows. Okay, EOF is the canonical way to tell a program reading stdin that you're done. It just happens that EOF ^D on *nix-likes and ^Z

Re: open() and EOFError

2014-07-08 Thread Tim Chase
On 2014-07-09 01:24, Chris Angelico wrote: > On Wed, Jul 9, 2014 at 1:20 AM, Tim Chase > > Okay, EOF is the canonical way to tell a program reading stdin > > that you're done. It just happens that EOF ^D on *nix-likes and > > ^Z on Win32. :-) > > > > -tkc &g

Re: ^D vs ^Z as EOF and DOS dinosaurs talking (was: open() and EOFError)

2014-07-08 Thread Tim Chase
On 2014-07-09 01:49, Chris Angelico wrote: > Have you ever used COPY CON to create a binary file? No, for that I used DEBUG.EXE (or DEBUG.COM on older versions of DOS) -tkc -- https://mail.python.org/mailman/listinfo/python-list

Re: open() and EOFError

2014-07-08 Thread Tim Chase
On 2014-07-09 01:24, Chris Angelico wrote: > I can't think of any Windows-native programs that ask for EOF. Only > those which came from POSIX platforms do it. That said, though, > Windows doesn't tend to encourage interactive command-line programs > at all, so you may as well just follow the Unix

Re: Proposal: === and !=== operators

2014-07-09 Thread Tim Chase
On 2014-07-09 12:48, Steven D'Aprano wrote: > On Wed, 09 Jul 2014 08:27:28 -0400, Roy Smith wrote: > > > We would have *three* ways to compare for equality (==, ===, and > > is). > > `is` does not, never has, and never will, be a test for equality. > > py> x = [] > py> y = [] > py> x is y > Fals

Re: How to decipher :re.split(r"(\(\([^)]+\)\))" in the example

2014-07-10 Thread Tim Chase
On 2014-07-10 22:18, Roy Smith wrote: > > Outside this are \( and \): these are literal opening and closing > > bracket characters. So: > > > >\(\([^)]+\)\) > > although, even better would be to use to utterly awesome >> re.VERBOSE > flag, and write it as: > > \({2} [^)]+ \){2} Or heck

Re: Python 3 is killing Python

2014-07-16 Thread Tim Roberts
tor that helped turn the tide in what otherwise would have been an ugly war of attrition, much like WWI. -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. -- https://mail.python.org/mailman/listinfo/python-list

Re: Python 3 is killing Python

2014-07-16 Thread Tim Roberts
s was sent from my iPhone" == "I have an iPhone!" Please note that iPhones come configured from the factory to say that. Some users probably don't even know it is happening. -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. -- https://mail.python.org/mailman/listinfo/python-list

Re: Python and IDEs [was Re: Python 3 is killing Python]

2014-07-19 Thread Tim Delaney
ect hg init hg add hg commit FWIW I also don't find a need for an IDE for Python - I'm quite happy using EditPlus (which I preferred enough to other alternatives on Windows to pay for many years ago). Tim Delaney -- https://mail.python.org/mailman/listinfo/python-list

Re: Python and IDEs [was Re: Python 3 is killing Python]

2014-07-19 Thread Tim Delaney
On 20 July 2014 09:19, Chris Angelico wrote: > On Sun, Jul 20, 2014 at 7:50 AM, Tim Delaney > wrote: > > IMO there is no project so modest that it doesn't require version > control. > > Especially since version control is as simple as: > > > > cd projec

Re: Python and IDEs [was Re: Python 3 is killing Python]

2014-07-19 Thread Tim Delaney
ok shuts down after 15 minutes. I'm surprised at how well I > was able to set up a equivalent programming environment on Windows. I advise anyone who works cross-platform to install MSYS on their Windows boxes (for the simplest, most consistent behaviour ignore rxvt and just launch bash -l - i directly). Or use cygwin if you prefer. Tim Delaney -- https://mail.python.org/mailman/listinfo/python-list

Re: Tabbed IDLE (was PyWart(2.7.8) IDLE is more buggy than "Joe's apartment"!)

2014-07-20 Thread Tim Chase
On 2014-07-20 23:40, Irmen de Jong wrote: > > And since IDLE is not a "tabbed editor", only *1* document > > is going to be displayed at a time. > > False. Idle opens any number of documents at the same time just > fine (in different windows - rather than tabs). This sounds like a failing of th

Re: Tabbed IDLE (was PyWart(2.7.8) IDLE is more buggy than "Joe's apartment"!)

2014-07-20 Thread Tim Chase
On 2014-07-20 23:40, Irmen de Jong wrote: > > And since IDLE is not a "tabbed editor", only *1* document > > is going to be displayed at a time. > > False. Idle opens any number of documents at the same time just > fine (in different windows - rather than tabs). This sounds like a failing of th

Re: PyWart(2.7.8) IDLE is more buggy than "Joe's apartment"!

2014-07-20 Thread Tim Chase
On 2014-07-20 19:06, Rick Johnson wrote: > > STEPS TO REPRODUCE BUG 1: "Attack of the clones!" > > > 1. Open the IDLE application > 2. Maximize the window that appears > 3. Go

Re: How to extract digit from a number?

2014-07-21 Thread Tim Chase
On 2014-07-21 13:14, fl wrote: > I see the following example on line, but it does not work. I do not > know what is wrong. Could you correct it for me? > > I'm not sure what [1, 1, 0, 0, 0, 0, ...] has to do with 128, but > if you want the base 10 digits: > > >>> a = 1234 > >>> [int(d) for d in s

Re: How to extract digit from a number?

2014-07-21 Thread Tim Chase
On 2014-07-21 13:42, fl wrote: > The original source input is: > >>> a = 1234 > >>> [int(d) for d in str(a)] > > He hopes the output is: > >>> [1, 2, 3, 4] > > In fact, I get the output is: > > >>> a = 1234 > >>> [int(d) for d in str(a)] > Traceback (most recent call last): > File "", line

Re: Distributing python applications as a zip file

2014-07-23 Thread Tim Golden
On 23/07/2014 06:30, Gary Herron wrote: > On 07/22/2014 09:23 PM, Steven D'Aprano wrote: >> A little known feature of Python: you can wrap your Python application in >> a zip file and distribute it as a single file. > Really! 20 years of Pythoning, and I'd never seen this! When was this > intr

Re: Pythonic way to iterate through multidimensional space?

2014-08-06 Thread Tim Chase
On 2014-08-06 11:04, Gayathri J wrote: > Below is the code I tried to check if itertools.product() was > faster than normal nested loops... > > they arent! arent they supposed to be...or am i making a mistake? I believe something like this was discussed a while ago and there was a faster-but-ugli

Re: Test for an empty directory that could be very large if it is not empty?

2014-08-06 Thread Tim Chase
On 2014-08-07 08:26, Ben Finney wrote: > Virgil Stokes writes: > > Suppose I have a directory C:/Test that is either empty or > > contains more than 200 files, all with the same extension > > (e.g. *.txt). How can I determine if the directory is empty > > WITHOUT the generation of a list of th

Re: Test for an empty directory that could be very large if it is not empty?

2014-08-07 Thread Tim Chase
On 2014-08-07 11:27, Ben Finney wrote: > > The difference in timings when serving a web-request are > > noticeable (in my use-case, I had to change my algorithm and > > storage structure to simplify/avoid heavily-populated > > directories) > > So, if the requirement is “test whether the director

Re: Test for an empty directory that could be very large if it is not empty?

2014-08-07 Thread Tim Chase
On 2014-08-07 07:54, Roy Smith wrote: > I wonder if glob.iglob('*') might help here? My glob.iglob() uses os.listdir() behind the scenes (see glob1() in glob.py) -tkc -- https://mail.python.org/mailman/listinfo/python-list

Re: Test for an empty directory that could be very large if it is not empty?

2014-08-07 Thread Tim Chase
On 2014-08-07 08:19, Roy Smith wrote: > > My glob.iglob() uses os.listdir() behind the scenes (see glob1() > > in glob.py) > > > > -tkc > > In which case, the documentation for iglob() is broken. It says: > > "Return an iterator which yields the same values as glob() without > actually stori

Re: The "right" way to use config files

2014-08-09 Thread Tim Chase
On 2014-08-09 13:48, Fabien wrote: > So I had the idea to define a super-object which parses the config > file and input data and is given as a single parameter to the > processing functions, and the functions take the information they > need from it. This is tempting because there is no need for >

Re: how to get the ordinal number in list

2014-08-11 Thread Tim Chase
On 2014-08-11 07:55, Roy Smith wrote: > > A C programmer asked to swap variables x and y, typically writes > > something like > > > > t = x; x = y; y = t; > > > > Fine, since C cant do better. > > Sure C can do better. > > x = x ^ y > y = y ^ x > x = x ^ y > > Any self-respecting C hacker wo

Re: Quoting and attribution (was: Python and IDEs [was Re: Python 3 is killing Python])

2014-08-11 Thread Tim Chase
On 2014-08-12 10:11, Steven D'Aprano wrote: > It is rude to deliberately refuse to give attributes While I find this true for first-level attribution, I feel far less obligation to attribute additional levels (and the verbosity they entail). If the reader is really that interested in who said what

Re: Quoting and attribution (was: Python and IDEs [was Re: Python 3 is killing Python])

2014-08-11 Thread Tim Chase
On 2014-08-12 02:07, Steven D'Aprano wrote: > >> It is rude to deliberately refuse to give attributes > > > > While I find this true for first-level attribution, I feel far > > less obligation to attribute additional levels (and the verbosity > > they entail). > > I cannot disagree with that.

Re: Captcha identify

2014-08-13 Thread Tim Chase
On 2014-08-13 12:24, Chris Kaynor wrote: > Many of the better captchas also include options for an audio cue in > addition to the default visual one. Have you actually tried to use the audio cue? They're atrocious. I got more intelligible words out of my old 8-bit SoundBlaster or a de-tuned radi

Re: how to change the time string into number?

2014-08-13 Thread Tim Chase
On 2014-08-14 09:46, luofeiyu wrote: > s="Aug" > > how can i change it into 8 with some python time module? >>> import time >>> s = "Aug" >>> time.strptime(s, "%b").tm_mon 8 works for me. -tkc -- https://mail.python.org/mailman/listinfo/python-list

Re: what is the "/" mean in __init__(self, /, *args, **kwargs) ?

2014-08-13 Thread Tim Chase
On 2014-08-14 10:01, luofeiyu wrote: > >>> help(int.__init__) > Help on wrapper_descriptor: > > __init__(self, /, *args, **kwargs) > Initialize self. See help(type(self)) for accurate signature. > > what is the "/" mean in __init__(self, /, *args, **kwargs) ? Where are you seeing this?

Re: how to change the time string into number?

2014-08-13 Thread Tim Chase
On 2014-08-13 21:01, Tim Chase wrote: > On 2014-08-14 09:46, luofeiyu wrote: > > s="Aug" > > > > how can i change it into 8 with some python time module? > > >>> import time > >>> s = "Aug" > >>> time.strptim

Re: Why Python 4.0 won't be like Python 3.0

2014-08-18 Thread Tim Delaney
t for major.minor.1. What is more important is that minor and patch version increases should avoid introducing breakage and incompatibilities wherever possible (security fixes are one reason to allow incompatibility in a minor release). BTW I agree with the idea that 4.0 would be an appropriate

Re: 'is not' or '!='

2014-08-19 Thread Tim Chase
On 2014-08-19 08:36, Steven D'Aprano wrote: > The English word "is" is the third-person singular simple present > indicative form of "be", Am I the only one who feels the urge to write if i am some_other_object: ... if we are some_other_object: ... if u are some_other_object: ... # though

Re: 'is not' or '!='

2014-08-19 Thread Tim Chase
On 2014-08-19 20:29, Marko Rauhamaa wrote: > The "is" relation can be defined trivially through the id() > function: > >X is Y iff id(X) == id(Y) > > What remains is the characterization of the (total) id() function. > For example, we can stipulate that: > >X = Y >assert(id(X) == id(

Re: Functions on list items

2014-08-19 Thread Tim Chase
On 2014-08-19 10:34, Kurt wrote: > I am trying to process the following calendar and data attributes > in a file: Da Mo Yr AttrA AttrB AttrC... > I need to average AttrA for each of 365 Da days across Yr years. > Then do the same for 27K files. Repeat for AttrB, AttrC etc. Can I > do the averaging

Re: 'is not' or '!='

2014-08-20 Thread Tim Chase
On 2014-08-20 21:17, Chris Angelico wrote: > That's true, but how easy is it to annotate a file with each line's > author (or, at least, to figure out who wrote some particular line > of code)? It's easy enough with 'git blame' or 'hg blame', and it > wouldn't surprise me if bzr had a similar featu

Re: Very basic question. How do I start again?

2014-08-21 Thread Tim Roberts
Seymore4Head wrote: > >I want to give the computer 100 tries to guess a random number between >1 and 100 picked by the computer. If it takes more than 7, you're doing it wrong... -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. -- https://mail.python.org/mailm

Re: Global indent

2014-08-23 Thread Tim Chase
On 2014-08-23 19:31, Steven D'Aprano wrote: > Sorry, but I have no idea what you mean by "orthogonal set of verbs > and nouns in an editing language". Can you explain? In the context of vi/vim, an "orthogonal set of verbs and nouns in an editing language" mean that you have a collection of verbs (

Re: Global indent

2014-08-23 Thread Tim Chase
On 2014-08-23 15:19, Joshua Landau wrote: > I have yet to be truly impressed by Vim, in that Sublime Text with a > few extensions seems to do the same things just as easily Can it be run remotely in a tmux session which can be accessed via SSH from multiple machines? ;-) Using the command-line:

Re: ANN: binario - simple work with binary files

2014-08-25 Thread Tim Roberts
struct: import struct dscrp = "H?fs5B" f = open('file.dat') stuff = struct.unpack( dscrp, f.read() ) print stuff In both cases, you have to KNOW the format of the data beforehand. If you do a read_short where you happen to have written a float, disaster ensues. I don't really see that you've added very much. -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. -- https://mail.python.org/mailman/listinfo/python-list

Re: iterating over strings seems to be really slow?

2014-08-27 Thread Tim Chase
On 2014-08-27 16:53, Rodrick Brown wrote: > *I'm confused why the former function runs significantly faster when > wc1() builds the hash on a single pass and doesn't waste memory of > returning an array of strings? * > > *I would think wc2() to be slower what's going on here? * > > > #!/usr/bin/

Re: python string, best way to concat

2014-08-27 Thread Tim Chase
On 2014-08-27 23:42, MRAB wrote: > How many parameters are there? len(self.param) > > Make that many placeholders and then join them together with commas: > > ', '.join(['?'] * len(self.param)) I prefer the clarity of Peter Otten's suggestion of ', '.join('?' * len(self.param)) over the mild

Re: hg, git, fossil, ...

2014-08-28 Thread Tim Chase
On 2014-08-28 08:58, Marko Rauhamaa wrote: > The main problem with hg (and git) is the way cherrypicking is done. > > See these graphics: > > [1] Product-Ver1 > | > | bugfix > | > V feature development >Product-Ver1'

Re: hg, git, fossil, ...

2014-08-28 Thread Tim Chase
On 2014-08-28 19:17, Marko Rauhamaa wrote: > > I feel like I am misunderstanding you. My summary of what you > > just said is, "I have two scenarios where my code went through > > different sequences of changes to end up with the same content. > > I expect both of those paths will show the same hi

Re: hg, git, fossil, ...

2014-08-28 Thread Tim Delaney
On 29 August 2014 02:32, Tim Chase wrote: > > No, you wouldn't use "hg pull" nor "git pull" but rather "git > cherry-pick" or what Mercurial calls "transplant" (I've not used this > in Mercurial, but I believe it's an extens

Re: Manually uninstall python 3.4.1 x64

2014-08-29 Thread Tim Golden
On 29/08/2014 09:19, Curtis Clauson wrote: Python v3.4.1 x64 on Windows 7 x64. I've a situation where the c:/Python34 directory was irrecoverably deleted. When I run the python-3.4.1.amd64.msi installer and choose Remove, it gives me a dialog saying a required file is missing about halfway thro

Re: I have tried and errored a reasonable amount of times

2014-08-30 Thread Tim Chase
On 2014-08-30 14:27, Seymore4Head wrote: > I really tried to get this without asking for help. > > mylist = ["The", "earth", "Revolves", "around", "Sun"] > print (mylist) > for e in mylist: > > # one of these two choices should print something. Since neither > does, I am missing something subtl

Distinguishing between maildir, mbox, and MH files/directories?

2014-08-31 Thread Tim Chase
Tinkering around with a little script, I found myself with the need to walk a directory tree and process mail messaged found within. Sometimes these end up being mbox files (with multiple messages within), sometimes it's a Maildir structure with messages in each individual file and extra holding di

Re: Editing text with an external editor in Python

2014-09-01 Thread Tim Chase
On 2014-09-02 04:23, Steven D'Aprano wrote: > Read $VISUAL, if it exists, otherwise $EDITOR, if it exists, > otherwise fall back on something hard coded. Or read it from an ini > file. Or create an entry in the register. Whatever. That's up to > the application which uses this function, not the fun

Re: ANN: binario - simple work with binary files

2014-09-01 Thread Tim Roberts
Rustom Mody wrote: >On Tuesday, August 26, 2014 6:58:42 AM UTC+5:30, Tim Roberts wrote: >> To the equivalent code with struct: > >> import struct > >> dscrp = "H?fs5B" > >> f = open('file.dat') >> stuff = struct.unpack( dsc

Best way to filter parts of a email.message.Message

2014-09-03 Thread Tim Chase
I'd like to do something like the following pseudocode existing_message = mailbox[key] # an email.message.Message new_message = email.message.Message() for part in existing_message.walk(): if passes_test(part): new_message.add(part) # need proper call here else: log("skip

Re: Best way to filter parts of a email.message.Message

2014-09-04 Thread Tim Chase
On 2014-09-04 14:08, Chris Angelico wrote: > On Thu, Sep 4, 2014 at 1:52 PM, Cameron Simpson wrote: >> On 03Sep2014 20:59, Tim Chase wrote: >>> - mime-parts can be nested, so I need to recursively handle them >> >> Just to this. IIRC, the MIME part delimiter is suppo

Re: ANN: binario - simple work with binary files

2014-09-06 Thread Tim Roberts
Rustom Mody wrote: >On Tuesday, September 2, 2014 6:05:19 AM UTC+5:30, Tim Roberts wrote: >> Rustom Mody wrote: > >> >On Tuesday, August 26, 2014 6:58:42 AM UTC+5:30, Tim Roberts wrote: > >> >> To the equivalent code with struct: >> >> import

Re: [OT] Question about Git branches

2014-09-16 Thread Tim Delaney
sy to switch between tasks - I just update to a different changeset (normally the tip of a named branch) and force a refresh in my IDE. When I'm happy, I merge into the feature branch, then pull the necessary changesets into other feature branch repos to merge/graft as appropriate. Branches and clones are two different ways of organising, and I find that things work best for me when I use both. Tim Delaney -- https://mail.python.org/mailman/listinfo/python-list

Re: [OT] Question about Git branches

2014-09-16 Thread Tim Delaney
ranch repo: [feature_branch_repo:65179] [feature_branch]> hg relink default relinking d:\home\repos\feature_branch_repo\.hg/store to d:\home\repos\default_repo\.hg/store tip has 22680 files, estimated total number of files: 34020 collected 229184 candidate storage files pruned down to 49838 probabl

Re: Is there a canonical way to check whether an iterable is ordered?

2014-09-18 Thread Tim Chase
On 2014-09-18 08:58, Roy Smith wrote: > I suspect what he meant was "How can I tell if I'm iterating over > an ordered collection?", i.e. iterating over a list vs. iterating > over a set. > > list1 = [item for item in i] > list2 = [item for item in i] > > am I guaranteed that list1 == list2? It

Re: very lightweight gui for win32 + python 3.4

2014-09-22 Thread Tim Roberts
transparent. And wxPython adds significant functionality on the top of that. -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. -- https://mail.python.org/mailman/listinfo/python-list

<    22   23   24   25   26   27   28   29   30   31   >