Re: annoying doctest problem

2015-01-12 Thread Skip Montanaro
On Mon, Jan 12, 2015 at 6:15 AM, Skip Montanaro wrote: > ... first implemented first ... s/first/doctest/ Darn auto-correct... Skip -- https://mail.python.org/mailman/listinfo/python-list

Re: annoying doctest problem

2015-01-12 Thread Skip Montanaro
On Mon, Jan 12, 2015 at 7:00 AM, Steven D'Aprano < [email protected]> wrote: > I didn't mean to give the impression that doctest was wrong to be fussy, or > dumb if you prefer. I think it's exactly the right behaviour. > I wasn't actually concerned that Steven might have misund

Re: Track down SIGABRT

2015-01-13 Thread Skip Montanaro
Assuming you have gdb available, you should be able to attach to the running process, then set a breakpoint in relevant functions (like exit() or abort()). Once there, you can pick through the C stack manually (kind of tedious) or use the gdbinit file which comes with Python to get a Python stack t

Re: lambdak: multi-line lambda implementation in native Python

2015-01-15 Thread Skip Montanaro
On Thu, Jan 15, 2015 at 7:04 AM, Roy Smith wrote: > I don't know which zen this is, but "Beauty is important". Kinda near the front: % python -m this The Zen of Python, by Tim Peters Beautiful is better than ugly. Explicit is better than implicit. Simple is better than complex. ... :-) Skip

Re: lambdak: multi-line lambda implementation in native Python

2015-01-15 Thread Skip Montanaro
On Thu, Jan 15, 2015 at 8:29 AM, Steven D'Aprano < [email protected]> wrote: > Now I shall try very hard to forget I ever saw it. There are some things, no matter how hard you try, which cannot be "unseen". :-) Skip -- https://mail.python.org/mailman/listinfo/python-list

Re: How to "wow" someone new to Python

2015-01-16 Thread Skip Montanaro
If you want to show off the REPL, I'd got for iPython and show them some simple matplotlib examples (plotting sin waves, maybe dig up a CSV file on the net with some data your friend is familiar with, etc) Skip On Fri, Jan 16, 2015 at 9:03 AM, Chris Angelico wrote: > Scenario: You're introduci

Re: lambdak: multi-line lambda implementation in native Python

2015-01-17 Thread Skip Montanaro
On Sat, Jan 17, 2015 at 5:59 AM, Jussi Piitulainen wrote: > How far do you want to go? Is "a b + c" the same as "a(b) + c" or the > same as "a(b + c)"? I think there is only one practical interpretation, the one that all shells I'm familiar with have adopted: a(b, +, c) > And I don't reall

Re: Python is DOOMED! Again!

2015-01-22 Thread Skip Montanaro
On Thu, Jan 22, 2015 at 12:03 PM, Sturla Molden wrote: > Python will no longer be dynamic, it will just be a slow static language. > > Yes, Python could still be used as a dynamic language, but nobody will > allow you to do it. Even packages in widespread use will be banned because > they don't t

Re: Python is DOOMED! Again!

2015-01-22 Thread Skip Montanaro
On Thu, Jan 22, 2015 at 1:22 PM, Marko Rauhamaa wrote: > > Just please don't FUD this list. > > Why do you think opinions on Python's future should be kept off this > list? The way you couched your opinion as a certainty, as if you could see the future, not as if you had an opinion stated like,

Re: Python is DOOMED! Again!

2015-01-22 Thread Skip Montanaro
On Thu, Jan 22, 2015 at 1:56 PM, Sturla Molden wrote: > On 22/01/15 20:43, Skip Montanaro wrote: > > The way you couched your opinion as a certainty, as if you could see the >> future, >> > > How do you know I cannot? Perhaps you can, but then your statements

Re: Python is DOOMED! Again!

2015-01-22 Thread Skip Montanaro
On Thu, Jan 22, 2015 at 2:31 PM, Skip Montanaro wrote: > Perhaps you can, but then your statements are opinions, then are they? Crap. I meant: "... then your statements aren't opinions ..." S -- https://mail.python.org/mailman/listinfo/python-list

Re: Python is DOOMED! Again!

2015-01-28 Thread Skip Montanaro
On Tue, Jan 27, 2015 at 7:26 PM, Steven D'Aprano < [email protected]> wrote: > (2) Algol, Ada, Boo, C, C#, C++, Cobol, Cobra, D, F#, Fantom, Fortran, Go, > Haskell, Java, Julia, Kotlin, Oberon, Pascal, Rust, Scala and dozens > (hundreds?) of other languages disagree with you. >

Re: multiprocessing module backport from 3 to 2.7 - spawn feature

2015-01-28 Thread Skip Montanaro
On Wed, Jan 28, 2015 at 7:07 AM, Andres Riancho wrote: > The feature I'm specially interested in is the ability to spawn > processes [1] instead of forking, which is not present in the 2.7 > version of the module. > Can you explain what you see as the difference between "spawn" and "fork" in thi

Re: Python is DOOMED! Again!

2015-01-28 Thread Skip Montanaro
On Wed, Jan 28, 2015 at 12:16 PM, Mark Lawrence wrote: > C and C++ are weakly and statically typed languages. Python is a strongly > and dynamically typed language. Feel free to edit this Google spreadsheet: -- https://mail.python.org/mailman/listinfo/python-list

Re: Python is DOOMED! Again!

2015-01-28 Thread Skip Montanaro
On Wed, Jan 28, 2015 at 12:34 PM, Skip Montanaro wrote: > > > On Wed, Jan 28, 2015 at 12:16 PM, Mark Lawrence > wrote: >> >> C and C++ are weakly and statically typed languages. Python is a strongly >> and dynamically typed language. > > > Feel fre

Re: The Most Diabolical Python Antipattern

2015-01-29 Thread Skip Montanaro
On Thu, Jan 29, 2015 at 11:17 AM, Mark Lawrence wrote: > > ... but what do you guys and gals think? I saw that blog referenced elsewhere a day or two ago. I think he's correct. There are the occasional instance where I need to recover from an exception no matter what caused it. In cases where I f

Re: how to parse sys.argv as dynamic parameters to another function?

2015-01-30 Thread Skip Montanaro
On Fri, Jan 30, 2015 at 10:09 AM, Robert Chen wrote: > > how to parse sys.argv as dynamic parameters to another function? > > > fun(sys.argv) Not sure what you mean by "dynamic", but I think you already have it, assuming fun is a function which accepts a single list of strings as its argument.

Re: Python is DOOMED! Again!

2015-01-30 Thread Skip Montanaro
On Fri, Jan 30, 2015 at 12:50 PM, Mario Figueiredo wrote: > It would help that if instead of weakly typed or strongly typed box, > they could be classified comparatively to each other. The terms are > better suited to describe two languages as they stand to each other. > > Weakly Typed --

Re: CSV and number formats

2015-02-01 Thread Skip Montanaro
On Sun, Feb 1, 2015 at 12:45 AM, Frank Millman wrote: > Is this a recognised format, and is there a standard way of parsing it? If > not, I will have to special-case it, but I would prefer to avoid that if > possible. Doesn't look "standard" to me in any fashion. You shouldn't need to special cas

pydoc3.5 borks on my Mac

2015-02-01 Thread Skip Montanaro
I build several versions of Python from Mercurial sources on a regular basis. I am starting on a new collection of programs for some database work and figured I should start using Python 3. I wanted to look something up quickly about the sqlite3 module, so I tried "pydoc sqlite3". That worked fine,

Re: pydoc3.5 borks on my Mac

2015-02-01 Thread Skip Montanaro
I finally got sort of smart, and started up a pydoc server. Looking at the sqlite3 docs through my browser, I see right off the bat, I see #-*- coding: ISO-8859-1 -*- # pysqlite2/__init__.py: the pysqlite2 package. # # Copyright (C) 2005 Gerhard Häring so my challenge is how to tell Python my te

Re: pydoc3.5 borks on my Mac

2015-02-01 Thread Skip Montanaro
On Sun, Feb 1, 2015 at 11:20 AM, Peter Otten <[email protected]> wrote: > Try setting the environment variable > > PYTHONIOENCODING=UTF-8 Thanks, but that didn't help. I still get the same exception. Skip -- https://mail.python.org/mailman/listinfo/python-list

Re: pydoc3.5 borks on my Mac

2015-02-01 Thread Skip Montanaro
On Sun, Feb 1, 2015 at 1:35 PM, Peter Otten <[email protected]> wrote: > $ LANG=en_US.UTF-8 python3 -c 'import locale; > print(locale.getpreferredencoding(False))' Aha! hgpython% LANG=en_US.UTF-8 python3.5 -c 'import locale; print(locale.getpreferredencoding(False))' UTF-8 hgpython% LANG=en_US.ut

Re: pydoc3.5 borks on my Mac

2015-02-01 Thread Skip Montanaro
On Sun, Feb 1, 2015 at 2:31 PM, Chris Angelico wrote: > Try the other variations: include the hyphen > but don't capitalize, and the other way around. On my system, all four > work equally: Yes, on my system, case doesn't matter, but the hyphen does. I just tried it out on one of my Linux system

Re: __pycache__

2015-02-03 Thread Skip Montanaro
On Tue, Feb 3, 2015 at 10:31 AM, Mark Lawrence wrote: > I know that you can target sites, but can you exclude them, e.g. > -site:stackoverflow.com ? Yes, you can. Compare the results of these two searches, for example: git initial push git initial push -site:stackoverflow.com Skip -- https://

Re: Usage of some pastebin service proposed

2015-02-05 Thread Skip Montanaro
On Wed, Feb 4, 2015 at 10:53 PM, Abhiram R wrote: > So is it possible to let everyone know that they need to paste their code on > some site like pastebin.com and give us the link here so help can be > provided better? Better would be to attach small code snippets. I agree with Ben about the HTM

Re: meaning of: line, =

2015-02-05 Thread Skip Montanaro
Tuple packing. No longer supported in Python 3, but in available in Python <= 2. Skip On Thu, Feb 5, 2015 at 10:45 AM, Rustom Mody wrote: > On Thursday, February 5, 2015 at 9:39:27 PM UTC+5:30, Ian wrote: >> On Thu, Feb 5, 2015 at 2:40 AM, Steven D'Aprano wrote: >> > Devin Jeanpierre wrote: >>

Python 3.x stuffing utf-8 into SQLite db

2015-02-08 Thread Skip Montanaro
I am trying to process a CSV file using Python 3.5 (CPython tip as of a week or so ago). According to chardet[1], the file is encoded as utf-8: >>> s = open("data/meets-usms.csv", "rb").read() >>> len(s) 562272 >>> import chardet >>> chardet.detect(s) {'encoding': 'utf-8', 'confidence': 0.99} so

Re: Python 3.x stuffing utf-8 into SQLite db

2015-02-09 Thread Skip Montanaro
On Sun, Feb 8, 2015 at 9:58 PM, Chris Angelico wrote: > Those three characters are the CP-1252 decode of the bytes for U+2019 > in UTF-8 (E2 80 99). Not sure if that helps any, but given that it was > an XLSX file, Windows codepages are reasonably likely to show up. Thanks, Chris. Are you telling

Re: Python 3.x stuffing utf-8 into SQLite db

2015-02-09 Thread Skip Montanaro
On Sun, Feb 8, 2015 at 10:51 PM, Steven D'Aprano wrote: > The second question is, are you > using Windows? No, I'm on a Mac (as, I think I indicated in my original note). All transformations occurred on a Mac. LibreOffice spit out a CSV file (with those three odd bytes). My script sucked in the C

Re: Python 3.x stuffing utf-8 into SQLite db

2015-02-09 Thread Skip Montanaro
On Mon, Feb 9, 2015 at 2:38 PM, Skip Montanaro wrote: > On Mon, Feb 9, 2015 at 2:05 PM, Zachary Ware > wrote: > > If all else fails, you can try ftfy to fix things: > > http://ftfy.readthedocs.org/en/latest/ > > Thanks for the pointer. I would prefer to not hand-mangl

Re: Python 3.x stuffing utf-8 into SQLite db

2015-02-10 Thread Skip Montanaro
On Mon, Feb 9, 2015 at 11:54 AM, Matthew Ruffalo wrote: > I think it's most likely that the encoding issues happened in the export > from XLSX to CSV (unless the data is malformed in the original XLSX > file, of course). Aha! Lookee here... (my apologies to all you HTML mail haters - sometimes it

Wildly OT: pop-up virtual keyboard for Mac or Linux?

2015-02-10 Thread Skip Montanaro
I know this is way off-topic for this group, but I figured if anyone in the online virtual communities I participate in would know the answer, the Pythonistas would... Google has so far not been my friend in this realm. One of the things I really like about my Skype keyboard (and likely other "sof

Re: Wildly OT: pop-up virtual keyboard for Mac or Linux?

2015-02-11 Thread Skip Montanaro
Thanks for all the ideas. As I'm an Emacs user (since Gosmacs in the early 80s), I will likely focus my attention there first. While the xkbmap/Xmodmap path seems like it would also work on Linux, I'm guessing Apple wouldn't allow that sort of thing to sully Mac OS X... Despite its name Skip --

Re: Odd version scheme

2015-02-12 Thread Skip Montanaro
I believe this sort of lexicographical comparison wart is one of the reasons the Python-dev gang decided that there would be no micro versions > 9. There are too many similar assumptions about version numbers out in the real world. Skip -- https://mail.python.org/mailman/listinfo/python-list

Go Ahead, Make my PEP... (was: PEP 441 - Improving Python ZIP Application Support)

2015-02-15 Thread Skip Montanaro
>From over yonder, on python-dev... > -- Forwarded message -- > From: Steve Dower > Subject: Re: [Python-Dev] PEP 441 - Improving Python ZIP Application Support > > "Go ahead, make my pep." > > We should make a python-dev t-shirt with this on it :) +1 from me as QOTW. Skip -- h

Re: tempfile mktemp function

2015-02-16 Thread Skip Montanaro
I can't offer an explanation, but you might open an issue in the tracker proposing that it be removed in 3.5. If nothing else, you should get an authoritative-ish explanation for why it has yet to be deleted. Skip -- https://mail.python.org/mailman/listinfo/python-list

Re: Standard

2015-02-22 Thread Skip Montanaro
On Thu, Feb 19, 2015 at 10:27 AM, Phillip Fleming wrote: > In my opinion, Python will not take off like C/C++ if there is no ANSI > standard. On one side of your statement, what makes you think Python ever wanted to "take off like C/C++"? On the other side, there are other languages (Java, PHP, P

Re: try pattern for database connection with the close method

2015-02-22 Thread Skip Montanaro
On Sun, Feb 22, 2015 at 12:41 PM, Mario Figueiredo wrote: > The sqlite context manager doesn't close a database connection on > exit. It only ensures, commits and rollbacks are performed. Sorry, I haven't paid careful attention to this thread, so perhaps this has already been suggested, however..

Well, that was a head scratcher...

2015-02-23 Thread Skip Montanaro
I've been reworking some of the code in the platform I use at work. I'm the sole developer/maintainer/hard-core user left, so I can pretty much do what I want with it (convert modules to Cython, delete no longer used modules, etc). The platform uses PyGtk, so we use signals and other features of t

Looking for someone who can build a 64-bit version of SpamBayes installer for Windows

2014-02-23 Thread Skip Montanaro
Python 2.7. Anybody available to help? Thanks, Skip Montanaro -- https://mail.python.org/mailman/listinfo/python-list

Re: An example of Python in action!

2014-02-25 Thread Skip Montanaro
On Tue, Feb 25, 2014 at 12:07 PM, Timothy W. Grove wrote: > Here is an example of Python being used with Maya for animation > http://vimeo.com/72276442 Maya as in MayaVi, the 3D data visualizer built atop VTK? Skip -- https://mail.python.org/mailman/listinfo/python-list

Re: An example of Python in action!

2014-02-25 Thread Skip Montanaro
On Tue, Feb 25, 2014 at 1:52 PM, Robert Kern wrote: > Maya as in Maya, the 3D animation software from AutoDesk. Ugh. What an unfortunate almost-name-clash... S -- https://mail.python.org/mailman/listinfo/python-list

Re: intersection, union, difference, symmetric difference for dictionaries

2014-02-25 Thread Skip Montanaro
On Tue, Feb 25, 2014 at 2:32 PM, mauro wrote: > So I wonder why operations such us intersection, union, difference, > symmetric difference that are available for sets and are not available > for dictionaries without going via key dictviews. What's the correct result of evaluating this expression?

Re: How security holes happen

2014-03-04 Thread Skip Montanaro
On Tue, Mar 4, 2014 at 11:07 AM, Chris Angelico wrote: > I don't have time to watch an hour-long video... what'd he do, exactly that? If you fast forward to 16:14, his talk is about five minutes long. He wrote a Lisp compiler whose backend is Python. Skip -- https://mail.python.org/mailman/list

Re: when to use == and when to use is

2014-03-10 Thread Skip Montanaro
I agree with Ben. In this particular case, it seems you really should be using "==" unless obj_0, obj_1, and obj_2 are sentinels. Skip -- https://mail.python.org/mailman/listinfo/python-list

Re: Save to a file, but avoid overwriting an existing file

2014-03-12 Thread Skip Montanaro
This seems to be an application-level decision. If so, in your application, why not just check to see if the file exists, and implement whatever workaround you deem correct for your needs? For example (to choose a simple, but rather silly, file naming strategy): fname = "x" while os.path.exists(fn

Re: Deep vs. shallow copy?

2014-03-12 Thread Skip Montanaro
On Wed, Mar 12, 2014 at 9:25 AM, Alex van der Spek wrote: > with open(os.path.join('path', 'foo.txt', 'rb') as txt: > reader = csv.reader(txt) > data = [row.append(year) for row in reader] Forget deep v. shallow copies. What is the value of the variable year? And why would you expect li

DB API question - where is a stored procedure's return value?

2014-03-12 Thread Skip Montanaro
I've stumbled on a problem with the python-sybase module. If I have a stored procedure like this: create stored procedure test_proc as return 1 and call it from Python like this: curs.callproc("test_proc", {}) it's not clear to me where the return status is stored. Currently, the python-syb

Re: DB API question - where is a stored procedure's return value?

2014-03-13 Thread Skip Montanaro
Thanks for the responses. We eventually figured out there appears to be a bug in the latest version of the python-sybase module (at least in 0.40, probably in 0.39 as well). It was actually detecting CS_STATUS_RESULT coming from the server and responding appropriately, however it was assigning the

Re: Looking for someone who can build a 64-bit version of SpamBayes installer for Windows

2014-03-17 Thread Skip Montanaro
> As more and > more Windows users have moved to 64-bit versions of Windows and > Outlook, we've had more and more reports of failures. > > I think all that's necessary (speaking as someone who knows nothing > about Windows) is for someone to build a 64-bit version of the > SpamBayes installer

Re: Looking for someone who can build a 64-bit version of SpamBayes installer for Windows

2014-03-17 Thread Skip Montanaro
On Mon, Mar 17, 2014 at 10:11 AM, Mark Lawrence wrote: >> https://mail.python.org/mailman/listinfo/python-win32 which is gated to >> gmane.comp.python.windows >> > > Or cgohlke at uci.edu as he maintains this "Unofficial Windows Binaries for > Python Extension Packages" here http://www.lfd.uci.edu

Re: 'complex' function with string argument.

2014-03-17 Thread Skip Montanaro
On Mon, Mar 17, 2014 at 5:06 PM, Terry Reedy wrote: > Mathematicians genearally write both without spaces. Mathematicians also have a tendency to use single letter variables and often escape into non-ASCII character sets as well. Perhaps it's worth pointing out that pylint complains about most/

Re: 'complex' function with string argument.

2014-03-17 Thread Skip Montanaro
On Mon, Mar 17, 2014 at 7:16 PM, Chris Angelico wrote: > On Tue, Mar 18, 2014 at 10:59 AM, Skip Montanaro wrote: >> Perhaps it's worth pointing out that pylint complains about most/many >> infix operations if you don't surround the operator with white space. > >

Re: 'complex' function with string argument.

2014-03-19 Thread Skip Montanaro
On Wed, Mar 19, 2014 at 5:33 AM, Ian Kelly wrote: > When is it ever useful though? About as often as int(0), float(0), or float(0.0) which all work as expected, though probably don't turn up in a lot of code. Skip -- https://mail.python.org/mailman/listinfo/python-list

Re: File Path/Global name issue

2014-03-20 Thread Skip Montanaro
On Thu, Mar 20, 2014 at 2:55 PM, wrote: > File "simpleRun.py", line 29 > help= ~/home/lai/Downloads/influence_matrix_files/hprd_inf_.mat) >^ > SyntaxError: invalid syntax You need quotes around the filename. It's a string literal. Skip -- https://mail.python.org/mailman/listinf

Re: File Path/Global name issue

2014-03-20 Thread Skip Montanaro
On Thu, Mar 20, 2014 at 3:08 PM, wrote: > simpleRun.py: error: argument -mf/--infmat_file is required I think you are misinterpreting the actual purpose of the parser_add_argument() call. It's telling you that *on the command line* you can specify it using either -mf some-file-name or --infma

Github down?

2014-03-21 Thread Skip Montanaro
Anybody else having trouble getting to Github? I'm trying to get to the pythondotorg issue tracker: https://github.com/python/pythondotorg/issues Thx, Skip -- https://mail.python.org/mailman/listinfo/python-list

Re: Github down?

2014-03-21 Thread Skip Montanaro
On Fri, Mar 21, 2014 at 8:24 AM, Larry Martell wrote: > https://twitter.com/githubstatus Thanks for the pointer. I'm an old fart and don't use social media much (in fact, just closed my FB account a couple days ago). Does that mean I'm a curmudgeon? :-) Skip -- https://mail.python.org/mailman/l

Re: unicode as valid naming symbols

2014-03-25 Thread Skip Montanaro
On Tue, Mar 25, 2014 at 2:48 PM, Marko Rauhamaa wrote: > I don't know if that's a good idea, but that's how it is in lisp/scheme. > > Thus, "*" and "1+" are normal identifiers in lisp and scheme. But parsing Lisp is pretty trivial. Skip -- https://mail.python.org/mailman/listinfo/python-list

Re: YADTR (Yet Another DateTime Rant)

2014-03-26 Thread Skip Montanaro
It's not clear to me what the correct str should be. I think the desired format changes depending on the relative magnitude of the timedelta object. For small values (less than a day), I agree, the behavior is, well, odd. You can get around that easily enough: >>> d = datetime.timedelta(seconds=-

Re: YADTR (Yet Another DateTime Rant)

2014-03-26 Thread Skip Montanaro
On Wed, Mar 26, 2014 at 10:04 AM, Roy Smith wrote: > No, what you said was "negative four days, positive 3605 seconds". My apologies for not showing all my work, professor. I use datetime and timedelta objects all the time. I did the arithmetic to go from 3605 to one hour, five minutes in my head

Re: YADTR (Yet Another DateTime Rant)

2014-03-26 Thread Skip Montanaro
On Wed, Mar 26, 2014 at 10:58 AM, Marko Rauhamaa wrote: > Fractions of seconds are supported -- the other fields can't be > fractional. Actually, it appears that whatever the last value you give can be fractionated. From the Wikipedia page you referenced: "The smallest value used may also have

Re: YADTR (Yet Another DateTime Rant)

2014-03-27 Thread Skip Montanaro
I took a moment to scan the datetime documentation. The behavior of str() on timedelta objects is very consistent, and matches the internal representation. From the docs: str(t) Returns a string in the form [D day[s], ][H]H:MM:SS[.UU], where D is negative for negative t. (5) Note (5) reads: S

Re: YADTR (Yet Another DateTime Rant)

2014-03-27 Thread Skip Montanaro
>> There are, >> as I see it, two common cases where t is negative: >> >> -1 day < t < 0 >> >> and >> >> t <= -1 day > > There are two types of negative numbers: Those closer to zero than -1, > and those not closer to zero than -1. Yeah, I think those are the most > common cases. :) Sorry I wa

Re: why i have the output of [None, None, None]

2014-04-10 Thread Skip Montanaro
The print function in Python 3 returns None. The "ok" output is a side effect. The actual value of evaluating that list comprehension is a list of three None values. Skip On Thu, Apr 10, 2014 at 8:54 AM, length power wrote: x=['','x1','x2','x3',' '] x > ['', 'x1', 'x2', 'x3', ' ']

selective (inheriting?) dir()?

2014-04-21 Thread Skip Montanaro
Before I get up to my neck in gators over this, I was hoping perhaps someone already had a solution. Suppose I have two classes, A and B, the latter inheriting from the former: class A: def __init__(self): self.x = 0 class B(A): def __init__(self): A.__init__(self)

Re: selective (inheriting?) dir()?

2014-04-21 Thread Skip Montanaro
dir__ undefined until after that little dance was complete. Skip On Mon, Apr 21, 2014 at 10:28 AM, Steven D'Aprano wrote: > On Mon, 21 Apr 2014 09:06:14 -0500, Skip Montanaro wrote: > > [...] >> Now, dir(inst_b) will list both 'x' and 'y' as attributes (alo

Re: Add "Received:" header to email msg in correct position?

2014-05-08 Thread Skip Montanaro
On Thu, May 8, 2014 at 8:46 AM, Ethan Furman wrote: > Some filtering of your sigs would be appreciated. Looks like a Zippy the Pinhead quote to me... http://rosinstrument.com/cgi-bin/fortune.pl/21?97 Skip -- https://mail.python.org/mailman/listinfo/python-list

Re: Everything you did not want to know about Unicode in Python 3

2014-05-13 Thread Skip Montanaro
On Tue, May 13, 2014 at 3:38 AM, Chris Angelico wrote: >> Python 2's ambiguity allows me not to answer the tough philosophical >> questions. I'm not saying it's necessarily a good thing, but it has its >> benefits. > > It's not a good thing. It means that you have the convenience of > pretending t

Re: problems decoding json objects

2014-05-14 Thread Skip Montanaro
On Wed, May 14, 2014 at 3:36 AM, Tamer Higazi wrote: > myjs = > '{"AVName":"Tamer","ANName":"Higazi","AAnschrift":"Bauerngasse","AHausnr":"1","APLZ":"55116","AOrt":"Mainz"},{"KontaktTel":["01234","11223344"],{"ZahlungsArt":"0"},{"ZugangsDaten":["[email protected]","mypass"]}' Following up o

Re: PEP 8 : Maximum line Length :

2014-05-15 Thread Skip Montanaro
On Thu, May 15, 2014 at 9:29 AM, Marko Rauhamaa wrote: > Who of you hasn't sworn at a Web editor that gets the formatting all > messed up when you have typed a backspace in the "wrong place?" My current pet peeve is the Gmail composition pane. What a load of crap (especially in rich text mode).

Reading OpenOffice spreadsheet in Python?

2014-05-20 Thread Skip Montanaro
I don't have Windows and since upgrading my Mac to Mavericks I no longer have Excel of any flavor. I have a few Excel spreadsheets in which I store parameters from which I generate other config files. I read those spreadsheets using xlrd. I am so fed up with LibreOffice's inability to properly sup

Re: Reading OpenOffice spreadsheet in Python?

2014-05-20 Thread Skip Montanaro
On Tue, May 20, 2014 at 2:45 PM, Martin Manns wrote: >> I am so fed up with LibreOffice's inability to properly support really >> basic Excel capabilities, I'm about ready to throw my computer out the > > Could you please give some examples, what basic Excel capabilities you > are missing? That's

Re: Reading OpenOffice spreadsheet in Python?

2014-05-20 Thread Skip Montanaro
On Tue, May 20, 2014 at 11:49 AM, Chris Angelico wrote: > Okay, I won't suggest Windows INI files, but I'll still suggest taking > a step back and figuring out exactly what you're trying to accomplish. > Can you separate out the real data from the formula-derived info, put > the former into a git-

Re: Reading OpenOffice spreadsheet in Python?

2014-05-20 Thread Skip Montanaro
> Are you familiar with emacs' org mode tables? > http://orgmode.org/org.html#Tables No. Thanks for the pointer. S -- https://mail.python.org/mailman/listinfo/python-list

Re: Reading OpenOffice spreadsheet in Python?

2014-05-21 Thread Skip Montanaro
On Wed, May 21, 2014 at 3:53 AM, Rustom Mody wrote: > Another possibility: Use google drive/docs spreadsheet capability. > Makes much less mess than libreoffice and will export to standard formats Correct, though it separates my spreadsheet from the Git repository, and means anyone else at work w

Re: OT: This Swift thing

2014-06-03 Thread Skip Montanaro
>From Apple's perspective, there's always platform lock-in. That's good for them, so it must be good for you, right? :-) Skip -- https://mail.python.org/mailman/listinfo/python-list

Re: OT: This Swift thing

2014-06-04 Thread Skip Montanaro
On Tue, Jun 3, 2014 at 4:49 PM, Mark H Harris wrote: > I have been engaged in a minor flame debate (locally) over block delimiters > (or lack thereof) which I'm loosing. Locally, people hate python's > indentation block delimiting, and wish python would adopt curly braces. Which reminds me of thi

Editing tabular data [was: PEP8 79 char max]

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

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

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

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

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

Re: outputting time in microseconds or milliseconds

2013-08-02 Thread Skip Montanaro
Perhaps use datetime? >>> now = datetime.datetime.now() >>> now.isoformat() '2013-08-02T07:37:08.430131' >>> now.strftime("%f") '430131' Skip -- http://mail.python.org/mailman/listinfo/python-list

Re: outputting time in microseconds or milliseconds

2013-08-02 Thread Skip Montanaro
> is the third column is only the microsecond? Yes. > how could i get this to write with the rest of the time (the hh:mm:ss) ? It sounds like you really want the time formatted in a particular way, not just the numeric value of one or more fields. Look at the documentation for the strftime meth

Re: PEP8 revised: max line lengths

2013-08-02 Thread Skip Montanaro
> The solely valid solution, assuming there is some wish, > is to define a maximal line width (preferably in SI units ;-) So, 79 * 8 points == 0.22295696 meters, right? :-) Skip -- http://mail.python.org/mailman/listinfo/python-list

Re: How to use Python to open Unread message(s) in specific Outlook folder, clicking a hyperlink within the email message to a secure login window, entering password to download .csv file, run Excel m

2013-08-02 Thread Skip Montanaro
> Reading outlook email, I found this: > > http://timgolden.me.uk/python/win32_how_do_i/read-my-outlook-inbox.html > > There is lots to find via google with 'reading outlook email with python' You might also want to look at the source for the SpamBayes Outlook plugin: https://pypi.python.org/pypi

Re: Can someone suggest better resources for learning sqlite3? I wanted to use the Python library but I don't know sql.

2013-08-07 Thread Skip Montanaro
> Can someone suggest me better resources for learning sql/sqlite3? The concepts behind the Structured Query Language haven't changed much since Edgar Codd first developed them in the 1970s. (He received the Turing Award in 1981 for this work.) Building and querying databases is very easy to do

Re: Can someone suggest better resources for learning sqlite3? I wanted to use the Python library but I don't know sql.

2013-08-07 Thread Skip Montanaro
> I have one on my desk at work whose name I can't remember off the > top of my head. I still refer to it from time-to-time. If you'd > like a reference, let me know and I'll check on it at work. While I think of it: "The Practical SQL Handbook; Using Structured Query Language," by Bowman, Emer

Re: outputting time in microseconds or milliseconds

2013-08-08 Thread Skip Montanaro
> i did: > >from time import strftime, time >from datetime import datetime > >now = datetime.now() > >self.logfile.write('%s\t'%(strftime("%Y-%m-%d",))) >self.logfile.write('%s\t'%(now.strftime("%H:%M:%S.%f",))) Note that you don't need the time module here. Datetime objects h

Re: Suggestion: PEP for popping slices from lists

2013-08-08 Thread Skip Montanaro
On Thu, Aug 8, 2013 at 6:40 AM, Neatu Ovidiu wrote: > This can be useful for doing all kinds of basic stuff. For example if you > wanted to take 4 items of a list at at a time, do something with them and > then update the list. > > jobs = ['job1', 'job2', 'job3', 'job5', 'job6', 'job7', 'job8',

Re: Python 3 and SSH Tunnel

2013-08-08 Thread Skip Montanaro
On Thu, Aug 8, 2013 at 2:30 PM, D. Xenakis wrote: > HOWTO anyone? > > What im trying to succeed here is create one SSH tunnel, so that i can > connect from a python script running on my pc, to a remote MySQL database > running on my Host and id like to stick with Python 3.3 . http://lmgtfy.com/

Re: PEP 450 Adding a statistics module to Python

2013-08-09 Thread Skip Montanaro
On Fri, Aug 9, 2013 at 8:10 PM, Steven D'Aprano wrote: > I am seeking comments on PEP 450, Adding a statistics module to Python's > standard library: > > http://www.python.org/dev/peps/pep-0450/ > > Please read the FAQs before asking anything :-) Given that installing numpy or scipy is generally

Re: PEP 450 Adding a statistics module to Python

2013-08-11 Thread Skip Montanaro
> See the Rationale of PEP 450 for more reasons why “install NumPy” is not > a feasible solution for many use cases, and why having ‘statistics’ as a > pure-Python, standard-library package is desirable. I read that before posting but am not sure I agree. I don't see the screaming need for this pa

Re: .split() Qeustion

2013-08-14 Thread Skip Montanaro
On Wed, Aug 14, 2013 at 12:05 PM, wrote: > Because high-level code isn't supposed to use the os module directly. That seems a bit extreme. One would hope that Guido and the rest of the crew created the os module so people would use it instead of resorting to other lower level hacks. A quick fi

Re: Encapsulation unpythonic?

2013-08-17 Thread Skip Montanaro
In Guido's own words: "We're all consenting adults here." http://importthis.tumblr.com/post/6719643315/public-private-attributes Skip -- http://mail.python.org/mailman/listinfo/python-list

Re: Check for the type of arguments

2013-08-17 Thread Skip Montanaro
Read up on "duck typing." Skip -- http://mail.python.org/mailman/listinfo/python-list

Re: Question about crypto

2013-08-18 Thread Skip Montanaro
> When I run the code above, I am told that the IV must be 16 bytes long. > I'm assuming that the IV (I know that means "Initialization Vector") is > either the key OR something else I can set. But I don't know how or what > to do. Does this Stack Overflow thread help? It looks to me like you are

utcoffset v. _utcoffset

2013-08-21 Thread Skip Montanaro
Consider this little Python script: import dateutil.parser import pytz x = dateutil.parser.parse("2013-08-16 23:00:00+01:00") localtz = pytz.timezone("America/Chicago") y = localtz.normalize(x) When I execute it (Python 2.7.2, dateutil 1.5, pytz 2011h), I get this traceback: Traceback (most rec

Missing something on exception handling in Python 3

2013-08-26 Thread Skip Montanaro
I have code in the pylockfile package that looks roughly like this (apologies for the indentation - I'm growing to dislike Gmail for typing code fragments): try: write_pid_to_lockfile(somefile) except OSError as exc: if conditions_i_can_handle: do_other_stuff... else: ra

Re: Missing something on exception handling in Python 3

2013-08-26 Thread Skip Montanaro
> Do this: > > raise LockFailed("Failed to create %s" % self.path) from None Thanks. Is there some construct which will work in 2.x and 3.x? Skip -- http://mail.python.org/mailman/listinfo/python-list

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