rst and pypandoc

2015-03-02 Thread alb
Hi everyone, I'm writing a document in restructured text and I'd like to convert it to latex for printing. To accomplish this I've used semi-successfully pandoc and the wrapper pypandoc. My biggest issue is with figures and references to them. We've our macro to allocate figures so I'm forced

reload a module imported with importlib.machinery.SourceFileLoader

2015-03-02 Thread Tal Einat
Hi everyone, I'm trying to import a module with tests, run the tests, then patch some things with mock.patch, reload the tests module and re-run the tests. This is part of an interactive course in which the tests module is written by the user. Therefore I'm using importlib.machinery.SourceFileLoad

Python27.dll could not be found

2015-03-02 Thread Sarvagya Pant
I have been writing a c++ program that is supposed to call the python function. The code is a snippet from python.org itself. #include #include #include int main() { Py_SetProgramName("Learning"); Py_Initialize(); PyRun_SimpleString("import hashlib\nprint hashlib.md5('sarvagya pant'

Re: Python Worst Practices

2015-03-02 Thread Chris Angelico
On Mon, Mar 2, 2015 at 3:52 AM, Mark Lawrence wrote: >> It's not one that we use out here in the Antipodes... probably a >> British peculiarity. Or perhaps an English peculiarity, but I would >> guess more likely British. >> >> ChrisA >> > > British. Never call me English, my mum was Welsh and wo

Md5 is different in Windows and Linux

2015-03-02 Thread Sarvagya Pant
Hello, I am amazed that the md5 of a file given by python in windows is different than that of linux. Consider the following code: import hashlib def md5_for_file(f, block_size=2**20): md5 = hashlib.md5() while True: data = f.read(block_size) if not data: break

Re: Question about python package numpy

2015-03-02 Thread Robert Kern
On 2015-03-01 20:32, fl wrote: Hi, It is difficult to install numpy package for my PC Windows 7, 64-bit OS. In the end, I install Enthought Canopy, which is recommended on line because it does install numpy automatically. Now, I can test it with import numpy it succeeds. On http://wiki.scipy.o

Re: Md5 is different in Windows and Linux

2015-03-02 Thread Tim Golden
On 02/03/2015 06:19, Sarvagya Pant wrote: > Hello, I am amazed that the md5 of a file given by python in windows is > different than that of linux. Consider the following code: > > import hashlib > def md5_for_file(f, block_size=2**20): > md5 = hashlib.md5() > while True: > data =

Re: Md5 is different in Windows and Linux

2015-03-02 Thread Peter Otten
Sarvagya Pant wrote: > Hello, I am amazed that the md5 of a file given by python in windows is > different than that of linux. Consider the following code: > > import hashlib > def md5_for_file(f, block_size=2**20): > md5 = hashlib.md5() > while True: > data = f.read(block_size)

Re: Python Worst Practices

2015-03-02 Thread alister
On Sun, 01 Mar 2015 20:14:13 -0800, Rustom Mody wrote: > On Sunday, March 1, 2015 at 10:32:00 PM UTC+5:30, Marko Rauhamaa wrote: >> Mark Lawrence : >> >> > Are you suggesting that we Brits have a single "home accent"? If you >> > are, you need to stand up as your voice is rather muffled. That b

PyPI, reStructuredText and readthedocs problems

2015-03-02 Thread Leonardo Giordani
Hi all, Some time ago I open sourced a package named postage ( https://pypi.python.org/pypi/postage/). I am experiencing issues with documentation. The project is hosted on GitHub (https://github.com/lgiordani/postage), where the README.md is perfectly rendered. My issues are: 1. I use pandoc to

Re: suggestions for functional style (singleton pattern?)

2015-03-02 Thread Fabien
On 01.03.2015 06:05, Michael Torrie wrote: A module*is* a singleton pattern, particularly one that maintains state. I use sometimes use this feature for sharing config and other data between other modules (global state when it's required). I do this too, after some helping recommendations I

Re: Md5 is different in Windows and Linux

2015-03-02 Thread Denis McMahon
On Mon, 02 Mar 2015 12:04:46 +0545, Sarvagya Pant wrote: > When I run the program I get the checksum value: > 2f9cc8da53ee89762a34702f745d2956 > > But on this site http://onlinemd5.com/ and on linux it has value > E10D4E3847713472F51BC606852712F1. > > Why is there difference in value of Checksum

Re: PyPI, reStructuredText and readthedocs problems

2015-03-02 Thread INADA Naoki
PyPI parses your README strictly. $ rst2html.py --strict README.rst README.rst:700: (INFO/1) Duplicate implicit target name: "fingerprint". Exiting due to level-1 (INFO) system message. But I don't know how to avoid this error when converting from markdown. On Mon, Mar 2, 2015 at 6:35 PM Leonard

Re: suggestions for functional style (singleton pattern?)

2015-03-02 Thread Mario Figueiredo
On Mon, 02 Mar 2015 11:19:06 +0100, Fabien wrote: >On 01.03.2015 06:05, Michael Torrie wrote: >> A module*is* a singleton pattern, particularly one >> that maintains state. I use sometimes use this feature for sharing >> config and other data between other modules (global state when it's >> r

Uncanny valley of languages

2015-03-02 Thread Jonas Wielicki
On 01.03.2015 18:34, Mark Lawrence wrote: > On 01/03/2015 17:01, Marko Rauhamaa wrote: >> Mark Lawrence : >> >>> Are you suggesting that we Brits have a single "home accent"? If you >>> are, you need to stand up as your voice is rather muffled. That by the >>> way is a British expression that may

Re: PyPI, reStructuredText and readthedocs problems

2015-03-02 Thread Wolfgang Maier
On 03/02/2015 11:33 AM, INADA Naoki wrote: PyPI parses your README strictly. $ rst2html.py --strict README.rst README.rst:700: (INFO/1) Duplicate implicit target name: "fingerprint". Exiting due to level-1 (INFO) system message. But I don't know how to avoid this error when converting from mark

Re: rst and pypandoc

2015-03-02 Thread Wolfgang Maier
On 03/02/2015 08:59 AM, alb wrote: Hi everyone, I'm writing a document in restructured text and I'd like to convert it to latex for printing. To accomplish this I've used semi-successfully pandoc and the wrapper pypandoc. My biggest issue is with figures and references to them. We've our macro

Re: Design thought for callbacks

2015-03-02 Thread Cem Karan
On Feb 26, 2015, at 3:00 PM, Ethan Furman wrote: > On 02/26/2015 11:54 AM, Ian Kelly wrote: > >> Sometimes I wonder whether anybody reads my posts. > > It's entirely possible the OP wasn't ready to understand your solution four > days ago, but two days later the OP was. Thank you Ethan, that

Re: Design thought for callbacks

2015-03-02 Thread Cem Karan
On Feb 26, 2015, at 7:04 PM, Fabio Zadrozny wrote: > > On Wed, Feb 25, 2015 at 9:46 AM, Cem Karan wrote: > > On Feb 24, 2015, at 8:23 AM, Fabio Zadrozny wrote: > > > Hi Cem, > > > > I didn't read the whole long thread, but I thought I'd point you to what > > I'm using in PyVmMonitor (http:

Re: Design thought for callbacks

2015-03-02 Thread Cem Karan
On Feb 26, 2015, at 2:54 PM, Ian Kelly wrote: > On Feb 26, 2015 4:00 AM, "Cem Karan" wrote: > > > > > > On Feb 26, 2015, at 12:36 AM, Gregory Ewing > > wrote: > > > > > Cem Karan wrote: > > >> I think I see what you're talking about now. Does WeakMethod > > >> (https://docs.python.org/3/librar

Re: PyPI, reStructuredText and readthedocs problems

2015-03-02 Thread Leonardo Giordani
Sorry, seems that GMail cannot understand I'm on a ML, and just answered the single persons. [Thread with INADA] Thank you. Seems that rst2html.py uses the header of a section as the id of the corresponding HTML anchor. Since I had two headers with the same title there was a name clash. I just ch

Pythonic locale

2015-03-02 Thread Albert-Jan Roskam
Hi, The Python locale standard libraries has some oddities and (long-standing) bugs. Example oddity: SETlocale *returns* a locale; getlocale output cannot always be consumed by setlocale. Example bug: resetlocale fails in Windows. What is your opinion about the work-around code below? import

Re: PyPI, reStructuredText and readthedocs problems

2015-03-02 Thread Leonardo Giordani
The libev problem happens on my local Ubuntu 14.10 too. It is not a pike requirement however (not installed by 'pip install pika'). Seems that pika forces some requirements when on readthedocs through this code on_rtd = os.environ.get('READTHEDOCS', None) == 'True' requirements = list() if on_rtd:

date

2015-03-02 Thread greymausg
I have a csv file, the first item on a line is the date in the format 2015-03-02 I try to get that as a date by date(row[0]), but it barfs, replying "Expecting an integer". (I am really trying to get the offset in weeks from that date to today()) -- greymaus . . ... -- https://mail.python.o

Re: rst and pypandoc

2015-03-02 Thread Dave Angel
On 03/02/2015 02:59 AM, alb wrote: Hi everyone, I'm writing a document in restructured text and I'd like to convert it to latex for printing. To accomplish this I've used semi-successfully pandoc and the wrapper pypandoc. I don't see other responses yet, so I'll respond even though i don't kn

Re: Python Worst Practices

2015-03-02 Thread Marko Rauhamaa
alister : > or as another analogy why don't you (Marco) try telling a Barber in > Seville that he should be speaking Latin Spanish not that strange > variation he uses? If the barber conference language were Latin, and some Spaniard insisted on speaking Western Andalusian, I sure would consider t

Re: Python27.dll could not be found

2015-03-02 Thread Dave Angel
On 03/02/2015 01:00 AM, Sarvagya Pant wrote: I have been writing a c++ program that is supposed to call the python function. The code is a snippet from python.org itself. #include #include #include int main() { Py_SetProgramName("Learning"); Py_Initialize(); PyRun_SimpleString(

Re: date

2015-03-02 Thread Fabien
On 02.03.2015 12:55, greymausg wrote: I have a csv file, the first item on a line is the date in the format 2015-03-02 I try to get that as a date by date(row[0]), but it barfs, replying "Expecting an integer". (I am really trying to get the offset in weeks from that date to today()) Have you t

Re: rst and pypandoc

2015-03-02 Thread Steven D'Aprano
alb wrote: [...] > For all the above reasons I'm writing snippets of pure latex in my rst > doc, but I'm having issues with the escape characters: > > i = '\ref{fig:abc}' Since \r is an escape character, that will give you carriage return followed by "ef{fig:abc". The solution to that is to eit

Re: Python Worst Practices

2015-03-02 Thread MRAB
On 2015-03-02 04:49, Dave Angel wrote: On 03/01/2015 08:59 PM, MRAB wrote: On 2015-03-02 01:37, Dennis Lee Bieber wrote You'd be able to run it on a TI99/4 (in which the BASIC interpreter, itself, was run on an interpreter... nothing like taking the first "16-bit" home computer and shackli

Re: Python Worst Practices

2015-03-02 Thread Manolo Martínez
On 03/02/15 at 08:59am, alister wrote: > or as another analogy why don't you (Marco) try telling a Barber in > Seville that he should be speaking Latin Spanish not that strange > variation he uses? > > I suspect the reaction you get will be far more severe than the one you > are getting from

Re: rst and pypandoc

2015-03-02 Thread alb
Hi Dave, Dave Angel wrote: [] > You should be a lot more explicit with all three parts of that > statement. Try: > > > I'm trying to get a string of \ref{fig:A.B} but unfortunately I need to go through a conversion between rst and latex. This is because a simple text like this: this is a

Re: date

2015-03-02 Thread Steven D'Aprano
greymausg wrote: > I have a csv file, the first item on a line is the date in the format > 2015-03-02 I try to get that as a date by date(row[0]), but it barfs, > replying "Expecting an integer". (I am really trying to get the offset > in weeks from that date to today()) What is "date"? Where doe

Re: Python Worst Practices

2015-03-02 Thread Dave Angel
On 03/02/2015 07:38 AM, MRAB wrote: On 2015-03-02 04:49, Dave Angel wrote: On 03/01/2015 08:59 PM, MRAB wrote: On 2015-03-02 01:37, Dennis Lee Bieber wrote The 16 bit address bus permitted addressing of 64k words. On most processors, that was 64k bytes, though I know one Harris had no by

Re: Md5 is different in Windows and Linux

2015-03-02 Thread Gene Heskett
On Monday 02 March 2015 01:19:46 Sarvagya Pant wrote: > Hello, I am amazed that the md5 of a file given by python in windows > is different than that of linux. Consider the following code: > > import hashlib > def md5_for_file(f, block_size=2**20): > md5 = hashlib.md5() > while True: >

Re: rst and pypandoc

2015-03-02 Thread alb
Hi Steven, Steven D'Aprano wrote: [] > Since \r is an escape character, that will give you carriage return followed > by "ef{fig:abc". > > The solution to that is to either escape the backslash: > > i = '\\ref{fig:abc}' > > > or use a raw string: > > i = r'\\ref{fig:abc}' ok, maybe I wasn't

Re: rst and pypandoc

2015-03-02 Thread Dave Angel
On 03/02/2015 08:51 AM, alb wrote: Hi Steven, Steven D'Aprano wrote: [] Since \r is an escape character, that will give you carriage return followed by "ef{fig:abc". The solution to that is to either escape the backslash: i = '\\ref{fig:abc}' or use a raw string: i = r'\\ref{fig:abc}' A

Re: rst and pypandoc

2015-03-02 Thread MRAB
On 2015-03-02 13:51, alb wrote: Hi Steven, Steven D'Aprano wrote: [] Since \r is an escape character, that will give you carriage return followed by "ef{fig:abc". The solution to that is to either escape the backslash: i = '\\ref{fig:abc}' or use a raw string: i = r'\\ref{fig:abc}' ok,

Re: date

2015-03-02 Thread Mark Lawrence
On 02/03/2015 12:25, Fabien wrote: On 02.03.2015 12:55, greymausg wrote: I have a csv file, the first item on a line is the date in the format 2015-03-02 I try to get that as a date by date(row[0]), but it barfs, replying "Expecting an integer". (I am really trying to get the offset in weeks fro

Re: rst and pypandoc

2015-03-02 Thread MRAB
On 2015-03-02 14:08, Dave Angel wrote: On 03/02/2015 08:51 AM, alb wrote: Hi Steven, Steven D'Aprano wrote: [snip] Oh, by the way, "i" is normally a terrible variable name for a string. Not only doesn't it explain what the variable is for, but there is a very strong convention in programm

(Still OT) Nationalism, language and monoculture [was Re: Python Worst Practices]

2015-03-02 Thread Steven D'Aprano
Marko Rauhamaa wrote: > alister : > >> or as another analogy why don't you (Marco) try telling a Barber in >> Seville that he should be speaking Latin Spanish not that strange >> variation he uses? > > If the barber conference language were Latin, and some Spaniard insisted > on speaking Western

Re: rst and pypandoc

2015-03-02 Thread Steven D'Aprano
Dave Angel wrote: > On 03/02/2015 08:51 AM, alb wrote: >> Hi Steven, >> >> Steven D'Aprano wrote: >> [] >>> Since \r is an escape character, that will give you carriage return >>> followed by "ef{fig:abc". >>> >>> The solution to that is to either escape the backslash: >>> >>> i = '\\ref{fig:abc}

Re: date

2015-03-02 Thread Steven D'Aprano
Mark Lawrence wrote: > Give me the Steven D'Aprano solution any day of > the week. Sounds ominous. Is that better or worse than the final solution? -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: date

2015-03-02 Thread greymausg
On 2015-03-02, Fabien wrote: > On 02.03.2015 12:55, greymausg wrote: >> I have a csv file, the first item on a line is the date in the format >> 2015-03-02 I try to get that as a date by date(row[0]), but it barfs, >> replying "Expecting an integer". (I am really trying to get the offset >> in wee

Re: date

2015-03-02 Thread greymausg
On 2015-03-02, Steven D'Aprano wrote: > greymausg wrote: > >> I have a csv file, the first item on a line is the date in the format >> 2015-03-02 I try to get that as a date by date(row[0]), but it barfs, >> replying "Expecting an integer". (I am really trying to get the offset >> in weeks from th

Re: date

2015-03-02 Thread Tim Golden
On 02/03/2015 14:44, Steven D'Aprano wrote: > Mark Lawrence wrote: > >> Give me the Steven D'Aprano solution any day of >> the week. > > > Sounds ominous. Is that better or worse than the final solution? > > > Well if you can have it on any day of the week it can't be *that* final? TJG --

Re: rst and pypandoc

2015-03-02 Thread Steven D'Aprano
alb wrote: > Hi Steven, > > Steven D'Aprano wrote: > [] >> Since \r is an escape character, that will give you carriage return >> followed by "ef{fig:abc". >> >> The solution to that is to either escape the backslash: >> >> i = '\\ref{fig:abc}' >> >> >> or use a raw string: >> >> i = r'\\re

Re: date

2015-03-02 Thread Mark Lawrence
On 02/03/2015 14:44, Steven D'Aprano wrote: Mark Lawrence wrote: Give me the Steven D'Aprano solution any day of the week. Sounds ominous. Is that better or worse than the final solution? As in "this program will inadvertantly self distruct in five seconds"? -- My fellow Pythonistas, ask

Re: (Still OT) Nationalism, language and monoculture [was Re: Python Worst Practices]

2015-03-02 Thread Marko Rauhamaa
Steven D'Aprano : > Marko Rauhamaa wrote: >> Similarly, I've heard some Finnish representatives in the Nordic >> Council complain how the Danish insist on speaking Danish. The >> official language there is Swedish. > > I'm reminded of the British Prime Minister David Lloyd George, who > apparently

Re: Design thought for callbacks

2015-03-02 Thread Ian Kelly
On Mon, Mar 2, 2015 at 4:04 AM, Cem Karan wrote: > On Feb 26, 2015, at 2:54 PM, Ian Kelly wrote: >> On Feb 26, 2015 4:00 AM, "Cem Karan" wrote: >> > >> > >> > On Feb 26, 2015, at 12:36 AM, Gregory Ewing >> > wrote: >> > >> > > Cem Karan wrote: >> > >> I think I see what you're talking about no

Re: Python Worst Practices

2015-03-02 Thread alister
On Mon, 02 Mar 2015 14:19:45 +0200, Marko Rauhamaa wrote: > alister : > >> or as another analogy why don't you (Marco) try telling a Barber in >> Seville that he should be speaking Latin Spanish not that strange >> variation he uses? > > If the barber conference language were Latin, and some Spa

Re: Python Worst Practices

2015-03-02 Thread Mark Lawrence
On 02/03/2015 15:32, alister wrote: On Mon, 02 Mar 2015 14:19:45 +0200, Marko Rauhamaa wrote: alister : or as another analogy why don't you (Marco) try telling a Barber in Seville that he should be speaking Latin Spanish not that strange variation he uses? If the barber conference language

Re: date

2015-03-02 Thread Fabien
On 02.03.2015 15:26, Mark Lawrence wrote: Have you tried Pandas? http://pandas.pydata.org/ If your csv file has no other problems, the following should do the trick: import pandas as pd df = pd.read_csv('file.csv', index_col=0, parse_dates= {"time" : [0]}) Cheers, Fabien IMHO complete ove

Re: (Still OT) Nationalism, language and monoculture [was Re: Python Worst Practices]

2015-03-02 Thread Chris Angelico
On Tue, Mar 3, 2015 at 1:39 AM, Steven D'Aprano wrote: > Whereas the comparatively small differences between British and American > English are all the more important because they distinguish the two. Nobody > is ever going to mistake Finland and the Finish people for Americans, even > if you lear

Re: date

2015-03-02 Thread Chris Angelico
On Tue, Mar 3, 2015 at 2:24 AM, Mark Lawrence wrote: > On 02/03/2015 14:44, Steven D'Aprano wrote: >> >> Mark Lawrence wrote: >> >>> Give me the Steven D'Aprano solution any day of >>> the week. >> >> >> >> Sounds ominous. Is that better or worse than the final solution? >> > > As in "this program

Re: (Still OT) Nationalism, language and monoculture [was Re: Python Worst Practices]

2015-03-02 Thread Joel Goldstick
I like "Old Tricks". I learn lots of British english idioms. I'm from NYC On Mon, Mar 2, 2015 at 10:45 AM, Chris Angelico wrote: > On Tue, Mar 3, 2015 at 1:39 AM, Steven D'Aprano > wrote: >> Whereas the comparatively small differences between British and American >> English are all the more imp

Re: date

2015-03-02 Thread alister
On Tue, 03 Mar 2015 02:51:28 +1100, Chris Angelico wrote: > On Tue, Mar 3, 2015 at 2:24 AM, Mark Lawrence > wrote: >> On 02/03/2015 14:44, Steven D'Aprano wrote: >>> >>> Mark Lawrence wrote: >>> Give me the Steven D'Aprano solution any day of the week. >>> >>> >>> >>> Sounds ominous. Is that

Re: suggestions for functional style (singleton pattern?)

2015-03-02 Thread Michael Torrie
On 03/02/2015 03:19 AM, Fabien wrote: > On 01.03.2015 06:05, Michael Torrie wrote: >> A module*is* a singleton pattern, particularly one >> that maintains state. I use sometimes use this feature for sharing >> config and other data between other modules (global state when it's >> required). >

Re: Python Worst Practices

2015-03-02 Thread Travis Griggs
> On Mar 1, 2015, at 5:53 PM, Dennis Lee Bieber wrote: > > On Sun, 1 Mar 2015 20:16:26 + (UTC), alister > declaimed the following: > >> >> The language is called English, the clue is in the name. interestingly >> most 'Brits' can switch between American English & English without too >>

Re: date

2015-03-02 Thread Chris Angelico
On Tue, Mar 3, 2015 at 3:09 AM, alister wrote: Sounds ominous. Is that better or worse than the final solution? >>> As in "this program will inadvertantly self distruct in five seconds"? >> >> It's usually implied as being externally enforced, so I'd say it's more >> akin to my solu

Re: date

2015-03-02 Thread Mark Lawrence
On 02/03/2015 15:51, Chris Angelico wrote: On Tue, Mar 3, 2015 at 2:24 AM, Mark Lawrence wrote: On 02/03/2015 14:44, Steven D'Aprano wrote: Mark Lawrence wrote: Give me the Steven D'Aprano solution any day of the week. Sounds ominous. Is that better or worse than the final solution?

Re: date

2015-03-02 Thread Mark Lawrence
On 02/03/2015 15:42, Fabien wrote: On 02.03.2015 15:26, Mark Lawrence wrote: Have you tried Pandas? http://pandas.pydata.org/ If your csv file has no other problems, the following should do the trick: import pandas as pd df = pd.read_csv('file.csv', index_col=0, parse_dates= {"time" : [0]})

Re: suggestions for functional style (singleton pattern?)

2015-03-02 Thread Ian Kelly
On Mon, Mar 2, 2015 at 8:59 AM, Michael Torrie wrote: > Now I don't know of any way of implementing class-style properties on a > module as you can do in a class, but if that were needed you would write > a standard class and instantiate a singleton inside the module itself > perhaps. This works,

Re: Python Worst Practices

2015-03-02 Thread alister
On Mon, 02 Mar 2015 08:25:40 -0800, Travis Griggs wrote: > seems like the very smallest of our worries. "There is no egg in eggplant" What the blood heck is eggplant? oh wait you mean aubergine this page is clearly about American English. We are even more obtuse, it stops Johnnie Foreigner kn

Re: Python Worst Practices

2015-03-02 Thread Jon Ribbens
On 2015-03-02, Dennis Lee Bieber wrote: > A pub's a bar; a bar's a gate; a gate's a street If each of those is supposed to be English first and then the American equivalent second, then I'm afraid the first one is misleading and the other two are just nonsense. -- https://mail.python.org/m

Re: date

2015-03-02 Thread greymausg
On 2015-03-02, greymausg wrote: > On 2015-03-02, Steven D'Aprano wrote: >> greymausg wrote: >> >>> I have a csv file, the first item on a line is the date in the format >>> 2015-03-02 I try to get that as a date by date(row[0]), but it barfs, >>> replying "Expecting an integer". (I am really tryi

Sort list of dictionaries

2015-03-02 Thread Charles Heizer
Hello, I'm new to python and I'm trying to find the right way to solve this issue I have. I'm trying to sort this list by name and then by version numbers. The problem I'm having is that I can not get the version numbers sorted with the highest at the top or sorted properly. mylist = [{'name'

Re: Sort list of dictionaries

2015-03-02 Thread Emile van Sebille
On 3/2/2015 10:17 AM, Charles Heizer wrote: Hello, I'm new to python and I'm trying to find the right way to solve this issue I have. I'm trying to sort this list by name and then by version numbers. The problem I'm having is that I can not get the version numbers sorted with the highest at t

Re: Sort list of dictionaries

2015-03-02 Thread Charles Heizer
Sorry, sortedlist = sorted(mylist , key=lambda elem: "%s %s" % (elem['name'], LooseVersion(elem['version'])), reverse=True) This is what I was trying but LooseVersion() was not sorting version numbers like I thought it would. You will notice that Chrome version "40.0.2214.111" is higher than "

Direct Client Requirement for Data Application Engineer (Hadoop) - Sunnyvale CA

2015-03-02 Thread tiya . akrid
Hi Please let me know if you have anyone available for below position Position - Data Application Engineer Location: Sunnyvale, CA (local candidates ONLY) Interview Process - Onsite Duration - 6 months + contract The Marketing Science team is looking for a Software Data Application Developer

Re: Sort list of dictionaries

2015-03-02 Thread Ian Kelly
On Mon, Mar 2, 2015 at 11:38 AM, Charles Heizer wrote: > Sorry, > > sortedlist = sorted(mylist , key=lambda elem: "%s %s" % (elem['name'], > LooseVersion(elem['version'])), reverse=True) > > This is what I was trying but LooseVersion() was not sorting version numbers > like I thought it would. Y

Re: rst and pypandoc

2015-03-02 Thread Dave Angel
On 03/02/2015 09:43 AM, Steven D'Aprano wrote: Dave Angel wrote: On 03/02/2015 08:51 AM, alb wrote: Hi Steven, Steven D'Aprano wrote: or use a raw string: i = r'\\ref{fig:abc}' Actually that'd be: i = r'\ref{fig:abc}' D'oh! I mean, you spotted my deliberate mistake to check i

Re: Sort list of dictionaries

2015-03-02 Thread Dave Angel
On 03/02/2015 01:38 PM, Charles Heizer wrote: Sorry, sortedlist = sorted(mylist , key=lambda elem: "%s %s" % (elem['name'], LooseVersion(elem['version'])), reverse=True) This is what I was trying but LooseVersion() was not sorting version numbers like I thought it would. You will notice that

Re: Sort list of dictionaries

2015-03-02 Thread Charles Heizer
Never mind, the light bulb finally went off. :-\ sortedlist = sorted(mylist , key=lambda elem: "%s %s" % ( elem['name'], (".".join([i.zfill(5) for i in elem['version'].split(".")])) ), reverse=True) On Monday, March 2, 2015 at 10:40:30 AM UTC-8, Charles Heizer wrote: > Sorry, > > sortedlist = s

Re: rst and pypandoc

2015-03-02 Thread Ben Finney
Dave Angel writes: > And D'oh right back at ya. Ironic isn't it that I make a second > mistake in the same message I correct yours? https://en.wikipedia.org/wiki/Muphry%27s_law> -- \ “Truth would quickly cease to become stranger than fiction, | `\ once we got as

Re: Python Worst Practices

2015-03-02 Thread sohcahtoa82
On Monday, March 2, 2015 at 9:13:21 AM UTC-8, Jon Ribbens wrote: > On 2015-03-02, Dennis Lee Bieber wrote: > > A pub's a bar; a bar's a gate; a gate's a street > > If each of those is supposed to be English first and then the American > equivalent second, then I'm afraid the first one is misl

Direct Client Requirement for Software Engineer in Quality - Sunnyvale CA

2015-03-02 Thread tiya . akrid
Hi Please let me know if you have anyone suitable for the below position Job title: Software Engineer in Quality Location: Sunnyvale, CA Interview Process: Onsite Duration: 6 months + contract Responsibilities: Work on an existing application in the Marketing Science team focused on maintain

Re: Md5 is different in Windows and Linux

2015-03-02 Thread sohcahtoa82
On Monday, March 2, 2015 at 12:43:59 AM UTC-8, Sarvagya Pant wrote: > Hello, I am amazed that the  md5 of a file given by python in windows is > different than that of linux. Consider the following code: > > import hashlib > def md5_for_file(f, block_size=2**20): >     md5 = hashlib.md5() >     w

Re: Sort list of dictionaries

2015-03-02 Thread Peter Otten
Charles Heizer wrote: > Never mind, the light bulb finally went off. :-\ > > sortedlist = sorted(mylist , key=lambda elem: "%s %s" % ( elem['name'], > (".".join([i.zfill(5) for i in elem['version'].split(".")])) ), > reverse=True) This lightbulb will break with version numbers > 9 ;) Here a

Re: Python27.dll could not be found

2015-03-02 Thread Gisle Vanem
Dave Angel wrote: When I ran Windows, I had written a simple utility that searched the PATH for a specified file. I called it which.bat to match the Linux equivalent. I've written a similar tool; envtool --path --python python27.dll Matches in %PATH: 15 May 2013 - 21:43:38: f:\ProgramF

Re: Python27.dll could not be found

2015-03-02 Thread Dave Angel
I INTENDED to send it to the list, but made the same mistake myself. Forwarded Message Subject: Re: Python27.dll could not be found Date: Mon, 02 Mar 2015 08:51:07 -0500 From: Dave Angel To: Sarvagya Pant Sarvaqya accidentally sent me private email, so I'm forwarding with co

Re: Python27.dll could not be found

2015-03-02 Thread Dave Angel
On 03/02/2015 02:22 PM, Gisle Vanem wrote: Dave Angel wrote: When I ran Windows, I had written a simple utility that searched the PATH for a specified file. I called it which.bat to match the Linux equivalent. I've written a similar tool; envtool --path --python python27.dll Matches in %PATH

Re: Python Worst Practices

2015-03-02 Thread Mark Lawrence
On 01/03/2015 17:52, Marko Rauhamaa wrote: Mark Lawrence : On 01/03/2015 17:01, Marko Rauhamaa wrote: What you (or I) speak in our native surroundings is up to you (and me). However, when I exhange software engineering ideas with you, I wish both of us could stick to American English. Well

Re: Picking apart a text line

2015-03-02 Thread Russell Owen
On 2/26/15 7:53 PM, memilanuk wrote: So... okay. I've got a bunch of PDFs of tournament reports that I want to sift thru for information. Ended up using 'pdftotext -layout file.pdf file.txt' to extract the text from the PDF. Still have a few little glitches to iron out there, but I'm getting d

Re: Python Worst Practices

2015-03-02 Thread Jon Ribbens
On 2015-03-02, sohcahto...@gmail.com wrote: > On Monday, March 2, 2015 at 9:13:21 AM UTC-8, Jon Ribbens wrote: >> On 2015-03-02, Dennis Lee Bieber wrote: >> >A pub's a bar; a bar's a gate; a gate's a street >> >> If each of those is supposed to be English first and then the American >> equiv

Re: rst and pypandoc

2015-03-02 Thread alb
Hi Dave, Dave Angel wrote: [] >> Rst escapes with "\", but unfortunately python also uses "\" for escaping! > > Only when the string is in a literal. If you've read it from a file, or > built it by combining other strings, or... then the backslash is just > another character to Python. Holy

Re: rst and pypandoc

2015-03-02 Thread alb
Hi MRAB, MRAB wrote: [] > Have you tried escaping the escape character by doubling the backslash? > > inp = 'ref{fig:abc}' In [54]: inp = 'ref{fig:abc}' In [55]: print pypandoc.convert(inp, 'latex', format='rst') \textbackslash{}ref\{fig:abc\} the backslash is considered as literal te

Re: rst and pypandoc

2015-03-02 Thread alb
Hi Dave, Dave Angel wrote: [] >>> or use a raw string: >>> >>> i = r'\\ref{fig:abc}' > > Actually that'd be: >i = r'\ref{fig:abc}' Could you explain why I then see the following difference: In [56]: inp = r'\\ref{fig:abc}' In [57]: print pypandoc.convert(inp, 'latex', format='rst') \textb

Re: (Still OT) Nationalism, language and monoculture [was Re: Python Worst Practices]

2015-03-02 Thread Gregory Ewing
Steven D'Aprano wrote: I remember the first time I realised that when Indians talk about "a code" they aren't using "wrong English", they are using a regional variation. I don't think this is confined to Indians. I've noticed that people from a Fortran scientific-computing background tend to us

Re: rst and pypandoc

2015-03-02 Thread Chris Angelico
On Tue, Mar 3, 2015 at 9:30 AM, alb wrote: > Hi Dave, > > Dave Angel wrote: > [] >>> Rst escapes with "\", but unfortunately python also uses "\" for escaping! >> >> Only when the string is in a literal. If you've read it from a file, or >> built it by combining other strings, or... then the ba

Re: rst and pypandoc

2015-03-02 Thread Mark Lawrence
On 02/03/2015 22:40, alb wrote: Hi Dave, Dave Angel wrote: [] or use a raw string: i = r'\\ref{fig:abc}' Actually that'd be: i = r'\ref{fig:abc}' Could you explain why I then see the following difference: In [56]: inp = r'\\ref{fig:abc}' In [57]: print pypandoc.convert(inp, 'latex',

Re: rst and pypandoc

2015-03-02 Thread Ben Finney
Chris Angelico writes: > And of course, that means you have to escape the backslash if you want > to have one in the text. But all of this is just for putting *string > literals* into your source code. If it's not Python source code, these > rules don't apply. You can read a line of text from the

Re: rst and pypandoc

2015-03-02 Thread Steven D'Aprano
alb wrote: > Could you explain why I then see the following difference: > > In [56]: inp = r'\\ref{fig:abc}' > > In [57]: print pypandoc.convert(inp, 'latex', format='rst') > \textbackslash{}ref\{fig:abc\} > > > In [58]: inp = r'\ref{fig:abc}' > > In [59]: print pypandoc.convert(inp, 'latex',

Re: rst and pypandoc

2015-03-02 Thread Dave Angel
On 03/02/2015 05:40 PM, alb wrote: Hi Dave, Dave Angel wrote: [] or use a raw string: i = r'\\ref{fig:abc}' Actually that'd be: i = r'\ref{fig:abc}' Could you explain why I then see the following difference: In [56]: inp = r'\\ref{fig:abc}' print inp and you should get \\re

Re: rst and pypandoc

2015-03-02 Thread Steven D'Aprano
alb wrote: > In [39]: print pypandoc.convert(s, 'latex', format='rst') > this is some restructured text. > > what happened to my backslash??? You'll need to read your pypandoc documentation to see what it says about backslashes. > If I try to escape my backslash I get something worse: > > In

Re: Md5 is different in Windows and Linux

2015-03-02 Thread Thomas Rachel
Am 02.03.2015 20:14 schrieb sohcahto...@gmail.com: On Monday, March 2, 2015 at 12:43:59 AM UTC-8, Sarvagya Pant wrote: f = open("somefile.txt") This one is the problem. Under Windows, you have to open the file in binary to avoid that something "bad" happens with it. So just do f = open("

Re: (Still OT) Nationalism, language and monoculture [was Re: Python Worst Practices]

2015-03-02 Thread Sturla Molden
Steven D'Aprano wrote: > Variations in idiom and spelling are a good thing. They open our minds to > new possibilities, remind us that we aren't all the same, and keep life > fresh. I remember the first time I realised that when Indians talk about "a > code" they aren't using "wrong English", the

Re: (Still OT) Nationalism, language and monoculture [was Re: Python Worst Practices]

2015-03-02 Thread Steven D'Aprano
Sturla Molden wrote: > Steven D'Aprano wrote: > >> Variations in idiom and spelling are a good thing. They open our minds to >> new possibilities, remind us that we aren't all the same, and keep life >> fresh. I remember the first time I realised that when Indians talk about >> "a code" they are

tarfile vs zipfile

2015-03-02 Thread Seth P
Is there a reason tarfile and zipfile don't use the same method/member names, where it makes sense? Consider the following six methods/members, which I would expect to be the same (with the possible exception of mtime vs date_time, which are of different types). It almost seems like someone we

Re: tarfile vs zipfile

2015-03-02 Thread Ben Finney
Seth P writes: > Is there a reason tarfile and zipfile don't use the same method/member > names, where it makes sense? One likely explanation is that the modules's APIs were designed by different people unaware of the work of the other. -- \“We have to go forth and crush every world v

  1   2   >