Re: help with SUDS

2013-09-23 Thread dieter
Ismar Sehic writes: > hello, i'm trying to make a wrapper for making xml requests to hotelbeds.com > site. > ... > File "/usr/lib/python2.6/urllib2.py", line 1172, in http_open > return self.do_open(httplib.HTTPConnection, req) > File "/usr/lib/python2.6/urllib2.py", line 1147, in do_ope

Re: Help with python functions?

2013-09-23 Thread Dave Angel
On 23/9/2013 21:23, kjaku...@gmail.com wrote: > On Monday, September 23, 2013 8:07:44 PM UTC-4, Dave Angel wrote: >> >> I didn't see any spec that said Python 3.x. in version 2.x, this would >> >> be incorrect. >> >> >> >> -- >> >> DaveA > > It's for Python 3.2 Then I'd have a comment say

Re: Help with python functions?

2013-09-23 Thread Steven D'Aprano
On Mon, 23 Sep 2013 15:32:37 -0700, kjakupak wrote: > def temp(T, from_unit, to_unit): > conversion_table = {('c', 'k'):lambda x: x + 273.15, > ('c', 'f'):lambda x: (x * (9.0/5)) + 32, ('k', > 'c'):lambda x: x - 273.15, >

Re: Help with python functions?

2013-09-23 Thread Steven D'Aprano
On Mon, 23 Sep 2013 15:55:53 -0700, kjakupak wrote: > As for the next one, so far I've gotten: def comp(T1, u1, T2, u2): > if u1 > u2: > return -1 > elif u2 > u1: > return 1 > else: > return 0 That is only comparing the units, not the temperatures. Since the

Re: Help with python functions?

2013-09-23 Thread Steven D'Aprano
On Mon, 23 Sep 2013 15:32:37 -0700, kjakupak wrote: > On Monday, September 23, 2013 9:56:45 AM UTC-4, Steven D'Aprano wrote: >> On Mon, 23 Sep 2013 05:57:34 -0700, kjakupak wrote: >> >> Now you're done! On to the next function... >> >> >> >> -- >> >> Steven > > def temp(T, from_unit, to_unit

Re: building an online judge to evaluate Python programs

2013-09-23 Thread Larry Hudson
On 09/23/2013 06:20 AM, Ned Batchelder wrote: If you want to run untrusted Python code and prevent malice (or stupidity) from harming you, you need OS-level protection. --Ned. That reminds me of the quote from Albert Einstein, (paraphrased): "There are only two things that are infinite,

Re: Help with python functions?

2013-09-23 Thread kjakupak
On Monday, September 23, 2013 10:12:05 PM UTC-4, Denis McMahon wrote: > > > If the first function you wrote allows you to convert temps in different > > scales to a common scale, then in the second function, you can call the > > first function to convert both temps to a common scale, and comp

Re: What minimum should a person know before saying "I know Python"

2013-09-23 Thread CM
On Friday, September 20, 2013 5:58:00 AM UTC-4, Aseem Bansal wrote: > I started Python 4 months ago. Largely self-study with use of Python > documentation, stackoverflow and google. I was thinking what is the minimum > that I must know before I can say that I know Python? Seems to me a fuzzy bou

Re: Help with python functions?

2013-09-23 Thread Denis McMahon
On Mon, 23 Sep 2013 15:55:53 -0700, kjakupak wrote: > As for the next one, so far I've gotten: > def comp(T1, u1, T2, u2): > if u1 > u2: > return -1 > elif u2 > u1: > return 1 > else: > return 0 If the first function you wrote allows you to convert temps in dif

Re: Help with python functions?

2013-09-23 Thread kjakupak
On Monday, September 23, 2013 8:07:44 PM UTC-4, Dave Angel wrote: > > I didn't see any spec that said Python 3.x. in version 2.x, this would > > be incorrect. > > > > -- > > DaveA It's for Python 3.2 -- https://mail.python.org/mailman/listinfo/python-list

Re: Help with python functions?

2013-09-23 Thread Dave Angel
On 23/9/2013 18:55, kjaku...@gmail.com wrote: > On Monday, September 23, 2013 9:56:45 AM UTC-4, Steven D'Aprano wrote: >> On Mon, 23 Sep 2013 05:57:34 -0700, kjakupak wrote: >> >> Now you're done! On to the next function... >> >> >> >> -- >> >> Steven > > def temp(T, from_unit, to_unit):

Re: python IDE and function definition

2013-09-23 Thread Neil Hodgson
Chris Friesen: where I could highlight the "stop" and ask it to go to the definition. (Where the definition is in a different file.) I'm running into issues where my current IDE (I'm playing with Komodo) can't seem to locate the definition, I suspect because it's too ambiguous. Some IDEs

Re: Help with python functions?

2013-09-23 Thread kjakupak
On Monday, September 23, 2013 9:56:45 AM UTC-4, Steven D'Aprano wrote: > On Mon, 23 Sep 2013 05:57:34 -0700, kjakupak wrote: > > Now you're done! On to the next function... > > > > -- > > Steven def temp(T, from_unit, to_unit): conversion_table = {('c', 'k'):lambda x: x + 273.15,

Re: Help with python functions?

2013-09-23 Thread Terry Reedy
On 9/23/2013 6:32 PM, kjaku...@gmail.com wrote: On Monday, September 23, 2013 9:56:45 AM UTC-4, Steven D'Aprano wrote: On Mon, 23 Sep 2013 05:57:34 -0700, kjakupak wrote: Now you're done! On to the next function... -- Steven def temp(T, from_unit, to_unit): conversion_table = {('c',

Re: Help with python functions?

2013-09-23 Thread kjakupak
On Monday, September 23, 2013 9:56:45 AM UTC-4, Steven D'Aprano wrote: > On Mon, 23 Sep 2013 05:57:34 -0700, kjakupak wrote: > > Now you're done! On to the next function... > > > > -- > > Steven def temp(T, from_unit, to_unit): conversion_table = {('c', 'k'):lambda x: x + 273.15,

Re: reload and work flow suggestions

2013-09-23 Thread Peter Cacioppi
On Saturday, September 21, 2013 2:43:13 PM UTC-7, Peter Cacioppi wrote: > This is an idea brought over from another post. > > > > When I write Python code I generally have 2 or 3 windows open simultaneously. > > > > 1) An editor for the actual code. > > 2) The interactive interpreter. > > 3

Re: how can I retrieve a particular tweet, having its tweet id?

2013-09-23 Thread Terry Reedy
On 9/23/2013 2:10 PM, Andres Soto wrote: how can I retrieve a particular tweet, having its tweet id, and the username, the date and the language? What, if anything, have you done to try to solve this yourself? Like searching the web? ('Python twitter' for instance) -- Terry Jan Reedy -- htt

how can I retrieve a particular tweet, having its tweet id?

2013-09-23 Thread Andres Soto
 how can I retrieve a particular tweet, having its tweet id, and the username, the date and the language? Regards Andrés Soto -- https://mail.python.org/mailman/listinfo/python-list

Re: What's the best way to extract 2 values from a CSV file from each row systematically?

2013-09-23 Thread Neil Cerutti
On 2013-09-23, quarantinemi...@gmail.com wrote: > Hey guys, > > I'm a little new to Python, and am still learning! > > I'm test building a web scraper that extracts prices from a > website, based on two values I want to extract from a CSV file. > The CSV has at least 1000 rows, an example: > > 0,0

Re: Sphinx Doctest: test the code without comparing the output.

2013-09-23 Thread Luca Cerone
> > The docstring for doctest.DocTestRunner contains the example code > > I was looking for. > > Thanks, I will give it a try! > > -- > > Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list

Re: Functional Programming and python

2013-09-23 Thread Vito De Tullio
rusi wrote: > [Not everything said there is correct; eg python supports currying better > [than haskell which is surprising considering that Haskell's surname is > [Curry!] AFAIK python does not support currying at all (if not via some decorators or something like that). Instead every function

Re: What's the best way to extract 2 values from a CSV file from each row systematically?

2013-09-23 Thread Tim Chase
On 2013-09-23 10:10, quarantinemi...@gmail.com wrote: > based on two values I want to extract from a CSV file. The > CSV has at least 1000 rows, an example: > > 0,0,KGD,0,DME,0,,0,0 [snip] > I'd like to automatically go through each row in the CSV file from > beginning to end to extract the two va

Re: python IDE and function definition

2013-09-23 Thread Chris Friesen
On 09/23/2013 09:32 AM, Fabio Zadrozny wrote: On Mon, Sep 23, 2013 at 12:06 PM, Chris Friesen mailto:cbf...@mail.usask.ca>> wrote: Hi all, I'm looking for a python IDE (for Linux) that can look at code like this: class ConductorManager(manager.__Manager): def compute_

Re: building an online judge to evaluate Python programs

2013-09-23 Thread Modulok
> > > If you want to run untrusted Python code and prevent malice (or stupidity) > from harming you, you need OS-level protection. > > Agreed. Just for fun here's a simple example of what could be an honest mistake that consumes all physical memory and swap. A well behaved kernel will kill the proc

Re: What's the best way to extract 2 values from a CSV file from each row systematically?

2013-09-23 Thread Joel Goldstick
On Mon, Sep 23, 2013 at 1:10 PM, wrote: > Hey guys, > > I'm a little new to Python, and am still learning! > > I'm test building a web scraper that extracts prices from a website, based > on two values I want to extract from a CSV file. The CSV has at least 1000 > rows, an example: > > 0,0,KGD,0,

Re: python IDE and function definition

2013-09-23 Thread Fabio Zadrozny
On Mon, Sep 23, 2013 at 2:29 PM, Chris Friesen wrote: > On 09/23/2013 09:32 AM, Fabio Zadrozny wrote: > >> On Mon, Sep 23, 2013 at 12:06 PM, Chris Friesen > > wrote: >> >> >> Hi all, >> >> I'm looking for a python IDE (for Linux) that can look at code like >>

help with SUDS

2013-09-23 Thread Ismar Sehic
hello, i'm trying to make a wrapper for making xml requests to hotelbeds.com site. this is what i got: import logging from suds.xsd.doctor import ImportDoctor, Import from suds.plugin import Plugin logging.basicConfig(level = logging.INFO) logging.getLogger('suds.client').setLevel(logging.DEBUG)

Re: Sphinx Doctest: test the code without comparing the output.

2013-09-23 Thread Neil Cerutti
On 2013-09-23, Luca Cerone wrote: >> It won't be very good documenation any more but nothing stops you >> >> from examining the result in the next doctest and making yourself >> >> happy about it. >> >> >> >> >>> x = input("indeterminate:") >> >> >>> result = "'{}'".format(x)) >> >> >

Re: Sphinx Doctest: test the code without comparing the output.

2013-09-23 Thread Neil Cerutti
On 2013-09-23, Neil Cerutti wrote: > Perhaps try the "advanced API" and define your oen > OutputChecker to add the feature that you need. > > Figuring out how to best invoke doctest with your modified > OutputChecker will take some digging in the source, probably > looking at doctest.testmod. I do

What's the best way to extract 2 values from a CSV file from each row systematically?

2013-09-23 Thread quarantinemiles
Hey guys, I'm a little new to Python, and am still learning! I'm test building a web scraper that extracts prices from a website, based on two values I want to extract from a CSV file. The CSV has at least 1000 rows, an example: 0,0,KGD,0,DME,0,,0,0 The values I want to extract are KGD and DM

Re: python IDE and function definition

2013-09-23 Thread Fabio Zadrozny
On Mon, Sep 23, 2013 at 12:06 PM, Chris Friesen wrote: > > Hi all, > > I'm looking for a python IDE (for Linux) that can look at code like this: > > class ConductorManager(manager.**Manager): > def compute_recover(self, context, instance): > self.compute_api.stop(context, instance, do_

Re: Sphinx Doctest: test the code without comparing the output.

2013-09-23 Thread Skip Montanaro
> I don't know why but it seems that google groups stripped the indentation > from the code. Because it's Google Groups. :-) 800-pound gorillas tend to do pretty much whatever they want. Skip -- https://mail.python.org/mailman/listinfo/python-list

Re: Sphinx Doctest: test the code without comparing the output.

2013-09-23 Thread Luca Cerone
I don't know why but it seems that google groups stripped the indentation from the code. I just wanted to ensure you that in the examples that I have run the definition of myfunc contained correctly indented code! On Monday, 23 September 2013 15:45:43 UTC+1, Luca Cerone wrote: > .. doctest:: exa

Re: Sphinx Doctest: test the code without comparing the output.

2013-09-23 Thread Luca Cerone
> It won't be very good documenation any more but nothing stops you > > from examining the result in the next doctest and making yourself > > happy about it. > > > > >>> x = input("indeterminate:") > > >>> result = "'{}'".format(x)) > > >>> result.startswith("'") and result.endswith("'

python IDE and function definition

2013-09-23 Thread Chris Friesen
Hi all, I'm looking for a python IDE (for Linux) that can look at code like this: class ConductorManager(manager.Manager): def compute_recover(self, context, instance): self.compute_api.stop(context, instance, do_cast=False) where I could highlight the "stop" and ask it to go to th

Re: parse list recurisively

2013-09-23 Thread andypu
i have a list and i want to search for a certain string and replace it. i think i got it now... sbxe1 = list([['type','ter','lala'],'name']) def parsesb(lis, string, replacement): for num, nam in enumerate (lis): if type(nam) == list: parse

Re: Making it a MultiThread!

2013-09-23 Thread stas poritskiy
Thanks for getting back to me, so i assume it is OK to have a very very long file? The sample code i posted here is basically the barebones of the main app. so, combining the GUI-file(gui.py) with main code is acceptable? Separating them into modules was initially the attempt to keep things in

Re: parse list recurisively

2013-09-23 Thread Oscar Benjamin
On 23 September 2013 13:53, wrote: > Hello, > > i use a load of lists and often i dont know how deep it is, how can i parse > that lists elegantly (without a bunch of for loops) I don't really understand what you mean. Can you show some code that illustrates what you're doing? http://sscce.org

Re: parse list recurisively

2013-09-23 Thread andypu
thanks i was not able to figure it out some days before but now i think i can do it myself: a nice function that searches a string in a list. def parsesb(lis, string): print lis for num, nam in enumerate (lis): print num, nam if type(nam) == list:

Re: python, pythontex and plots

2013-09-23 Thread chitturk
True, I did not explain what I was trying to do. pythontex is a package that allows the inclusion of python code within a LaTeX document - (sort of like python.sty, but IMO, better) - I use it along with noweb to create documents that contain documentation, code and output of the code - and python

Re: Help with python functions?

2013-09-23 Thread Steven D'Aprano
On Mon, 23 Sep 2013 05:57:34 -0700, kjakupak wrote: > Can anyone help me with any of these please? Much appreciated. I > honestly don't even know how to start them Start by writing a function that does nothing: def nothing(): pass Now change it so that it takes three arguments: T, a tempe

Re: Sphinx Doctest: test the code without comparing the output.

2013-09-23 Thread Neil Cerutti
On 2013-09-22, Luca Cerone wrote: > I understand your point, but now I am not writing unit tests to > check the correctness of the code. I am only writing a tutorial > and assuming that the code is correct. What I have to be sure > is that the code in the tutorial can be executed correctly, and >

Re: Help with python functions?

2013-09-23 Thread Roy Smith
In article , kjaku...@gmail.com wrote: > 1.a. Write a function temp(T, from_unit, to_unit) where from_unit and to_unit > are temperature units, either 'F' (or 'f') for fahrenheit, or 'C' (or 'c') > for celsius, or 'K' (or 'k') for kelvin; and T is a temperature number for > the unit from_unit.

Re: building an online judge to evaluate Python programs

2013-09-23 Thread Ned Batchelder
On 9/23/13 8:33 AM, Fábio Santos wrote: On 20 Sep 2013 21:14, "Jabba Laci" > wrote: > > > That last seems to me to be the biggie. Several times in the past few > > years, people in this mailing list have tried to build a safe sandbox. > > And each one was a big fa

Re: Python Interview Questions

2013-09-23 Thread Roy Smith
Somebody, whose identity has been lost in three-deep quoting, said: > > > I am now appearing for Job Interviews these days and I am > > > wondering if anybody of you appeared for a Python > > > Interview. Can you please share the questions you were > > > asked. That will be great help to me. We ha

Re: parse list recurisively

2013-09-23 Thread Chris Angelico
On Mon, Sep 23, 2013 at 10:53 PM, wrote: > Hello, > > i use a load of lists and often i dont know how deep it is, how can i parse > that lists elegantly (without a bunch of for loops) You can write a function that calls itself - that's what "recursive" usually means in programming. Start with t

Help with python functions?

2013-09-23 Thread kjakupak
1.a. Write a function temp(T, from_unit, to_unit) where from_unit and to_unit are temperature units, either 'F' (or 'f') for fahrenheit, or 'C' (or 'c') for celsius, or 'K' (or 'k') for kelvin; and T is a temperature number for the unit from_unit. The function should return the temperature numbe

parse list recurisively

2013-09-23 Thread andypu
Hello, i use a load of lists and often i dont know how deep it is, how can i parse that lists elegantly (without a bunch of for loops) -- https://mail.python.org/mailman/listinfo/python-list

Re: building an online judge to evaluate Python programs

2013-09-23 Thread Fábio Santos
On 20 Sep 2013 21:14, "Jabba Laci" wrote: > > > That last seems to me to be the biggie. Several times in the past few > > years, people in this mailing list have tried to build a safe sandbox. > > And each one was a big failure, for a hacker of sufficient interest. > > Some of them were spectacul

[ANN] pyspread 0.2.5

2013-09-23 Thread Martin Manns
== pyspread 0.2.5 == Pyspread 0.2.5 is released. This is mainly a bug fix release with some improvements in chart creation and CSV import. About pyspread == Pyspread is a non-traditional spreadsheet application that is based on and written in the programming

Re: reload and work flow suggestions

2013-09-23 Thread Oscar Benjamin
On 23 September 2013 10:35, rusi wrote: >> Then, I launch iPython, which can intellisense launch 3 easily. Then I make >> whatever changes I need to 1-3 to make a baby step forward, close iPython, >> and repeat. > > Hardly looks very ergonomic to me I'm not quite sure what's meant by intellisense

Re: How To Build Scrapy Environment

2013-09-23 Thread YetToCome
在 2013年9月23日星期一UTC+8下午5时25分25秒,Peter Otten写道: > YetToCome wrote: > > > > [snip] > > > > No need to quote the whole turd -- just confirm that it worked... > > > > > it had an another error: No module named queuelib, but i have installed > > > all the libs mentioned in that passage... > >

Re: reload and work flow suggestions

2013-09-23 Thread rusi
On Monday, September 23, 2013 2:01:00 PM UTC+5:30, Peter Cacioppi wrote: > One thing re: editors and interactive environments. I'm not a huge emacs fan > (ducking) and I really like iPython. Heh! Yeah we are an endangered species G enerally N ot U sed E ditor for M iddle A ged C omputer S cientis

Re: How To Build Scrapy Environment

2013-09-23 Thread Peter Otten
YetToCome wrote: [snip] No need to quote the whole turd -- just confirm that it worked... > it had an another error: No module named queuelib, but i have installed > all the libs mentioned in that passage... > ImportError: Error loading object 'scrapy.core.scheduler.Scheduler': No > module n am

Re: How To Build Scrapy Environment

2013-09-23 Thread YetToCome
在 2013年9月23日星期一UTC+8下午4时12分21秒,YetToCome写道: > I have already install Twisted, zope.interface, w3lib, libxml2, etc,but it > still can not be built,here is the error message: > > > > Traceback (most recent call last): > > File "C:\Python27\lib\runpy.py", line 162, in _run_module_as_main > >

Re: How To Build Scrapy Environment

2013-09-23 Thread YetToCome
在 2013年9月23日星期一UTC+8下午4时37分22秒,Peter Otten写道: > YetToCome wrote: > > > > > I have already install Twisted, zope.interface, w3lib, libxml2, etc,but it > > > still can not be built,here is the error message: > > > > > > Traceback (most recent call last): > > > File "C:\Python27\lib\runpy.py

Re: reload and work flow suggestions

2013-09-23 Thread Peter Cacioppi
On Saturday, September 21, 2013 2:43:13 PM UTC-7, Peter Cacioppi wrote: > This is an idea brought over from another post. > > > > When I write Python code I generally have 2 or 3 windows open simultaneously. > > > > 1) An editor for the actual code. > > 2) The interactive interpreter. > > 3

Re: How To Build Scrapy Environment

2013-09-23 Thread Peter Otten
YetToCome wrote: > I have already install Twisted, zope.interface, w3lib, libxml2, etc,but it > still can not be built,here is the error message: > > Traceback (most recent call last): > File "C:\Python27\lib\runpy.py", line 162, in _run_module_as_main > "__main__", fname, loader, pkg_name)

How To Build Scrapy Environment

2013-09-23 Thread YetToCome
I have already install Twisted, zope.interface, w3lib, libxml2, etc,but it still can not be built,here is the error message: Traceback (most recent call last): File "C:\Python27\lib\runpy.py", line 162, in _run_module_as_main "__main__", fname, loader, pkg_name) File "C:\Python27\lib\runp

Re: Why do I have to use "global" so much when using Turtle?

2013-09-23 Thread John Ladasky
No, Rusi, I have never seen Pynguin before -- and it looks very cool! -- https://mail.python.org/mailman/listinfo/python-list

Re: Directory Web Site

2013-09-23 Thread Chris Angelico
On Mon, Sep 23, 2013 at 11:14 AM, wrote: > Was hoping to get some tips or advice on scripting a program that would sort > through my many links on my directory website and print out to me the ones > that are broken or no longer functioning so that I could fix or remove them > from the site. An