Re: with ignored

2013-04-07 Thread Barrett Lewis
> > However, ignored() is actually implemented as a generator function > with the @contextmanager decorator shortcut. This decorator takes a > generator function and wraps it up as a class with the necessary > __enter__ and __exit__ methods. The __enter__ method in this case > calls the .next() m

Re: with ignored

2013-04-07 Thread Ian Kelly
On Sun, Apr 7, 2013 at 6:40 PM, Barrett Lewis wrote: > I was recently watching that Raymond Hettinger video on creating Beautiful > Python from this years PyCon. > He mentioned pushing up the new idiom > > with ignored(): > # do some work > > I tracked down his commit here http://hg.python.or

"pip install PySide" fails from local Python installs

2013-04-07 Thread austinmatherne
I've used pythonbrew, pythonz, and pyenv to install CPython 3.3.1, but all of them give me the same error when running "pip install PySide": error: Failed to locate the Python library /home/.../lib/libpython3.3m.so Is this a problem with PySide, or with the various local Python installers I've

Re: Newbie to python. Very newbie question

2013-04-07 Thread Steven D'Aprano
On Sun, 07 Apr 2013 04:16:27 -0700, ReviewBoard User wrote: > Hi > I am a newbie to python and am trying to write a program that does a sum > of squares of numbers whose squares are odd. For example, for x from 1 > to 100, it generates 165 as an output (sum of 1,9,25,49,81) > > Here is the code I

Re: Splitting of string at an interval

2013-04-07 Thread Chris Angelico
On Mon, Apr 8, 2013 at 7:48 AM, Steven D'Aprano wrote: > Like every programming problem, the solution is to break it apart into > small, simple steps that even a computer can follow. > ... 5) Shortcut the whole thing, since the problem was underspecified, by using a literal. words = ["The Sun",

Re: im.py: a python communications tool

2013-04-07 Thread Chris Angelico
On Mon, Apr 8, 2013 at 8:36 AM, Steven D'Aprano wrote: > On Sun, 07 Apr 2013 14:47:11 -0700, jhunter.dunefsky wrote: > >> Actually, my current licence can be found here: >> https://github.com/jhunter-d/im.py/blob/master/LICENCE. Whaddaya think >> about this, Useneters? > > > I think you're lookin

with ignored

2013-04-07 Thread Barrett Lewis
I was recently watching that Raymond Hettinger video on creating Beautiful Python from this years PyCon. He mentioned pushing up the new idiom with ignored(): # do some work I tracked down his commit here http://hg.python.org/cpython/rev/406b47c64480 But am unsure how the yield works in the

Re: Newbie to python. Very newbie question

2013-04-07 Thread Miki Tebeka
> I can't even read that mess... three nested lambda? I have to say this and other answers in this thread seem not that friendly to me. The OP said it's a newbie question, we should be more welcoming to newcomers. -- http://mail.python.org/mailman/listinfo/python-list

Re: I hate you all

2013-04-07 Thread Roland Koebler
Hi, > Well all previous (python 2) code is meant to work for a tab size of > 8. yes, but even in Python 2, mixing spaces and tabs is considered bad style and should be avoided. And code-checkers like pylint (which I can recommend to everyone) create a warning. > You may call this "categorically w

Re: Error in Python NLTK

2013-04-07 Thread Steven D'Aprano
On Sun, 07 Apr 2013 15:11:36 -0700, subhabangalore wrote: [snip 200+ lines of irrelevant quoted text] > Dear Sir, > I was trying to give wrong input. I was making an input error. Please, use the delete key to remove unnecessary text from your messages. We shouldn't have to scroll past THREE AND

Re: im.py: a python communications tool

2013-04-07 Thread Steven D'Aprano
On Sun, 07 Apr 2013 14:47:11 -0700, jhunter.dunefsky wrote: > Actually, my current licence can be found here: > https://github.com/jhunter-d/im.py/blob/master/LICENCE. Whaddaya think > about this, Useneters? I think you're looking for a world of pain, when somebody uses your software, it break

Re: Error in Python NLTK

2013-04-07 Thread subhabangalore
On Monday, April 8, 2013 1:50:38 AM UTC+5:30, subhaba...@gmail.com wrote: > On Sunday, April 7, 2013 2:14:41 AM UTC+5:30, Dave Angel wrote: > > > On 04/06/2013 03:56 PM, subhabangal...@gmail.com wrote: > > > > > > > Dear Group, > > > > > > > > > > > > > > I was using a package named NLTK

Re: Splitting of string at an interval

2013-04-07 Thread Steven D'Aprano
On Sun, 07 Apr 2013 13:25:57 -0700, subhabangalore wrote: > Dear Group, > > I was looking to split a string in a particular interval, like, > > If I have a string, > string="The Sun rises in the east of our earth" > > I like to see it as, > words=["The Sun","rises in","in the","east of","our e

Re: im.py: a python communications tool

2013-04-07 Thread jhunter . dunefsky
On Sunday, April 7, 2013 4:59:10 AM UTC-4, garabik-ne...@kassiopeia.juls.savba.sk wrote: > Andrew Berg wrote: > > > On 2013.04.05 20:07, Roy Smith wrote: > > >> I know this is off-topic, but I encourage people to NOT invent their own > > >> licenses. > > > Perhaps he meant this existing lice

Re: __doc__ string for getset members

2013-04-07 Thread Steven D'Aprano
On Sun, 07 Apr 2013 21:21:03 +0100, Arnaud Delobelle wrote: > On 7 April 2013 19:02, Nick Gnedin wrote: [...] >> My question is - how do I access the doc string "mem-doc-string" >> supplied in the PyGetSetDef structure? If I type >> >> print(obj.mem.__doc__) >> >> then the __doc__ string for the

Re: __doc__ string for getset members

2013-04-07 Thread Arnaud Delobelle
On 7 April 2013 21:38, Nick Gnedin wrote: > > Arnaud, > > Thanks for the answer. I understand that I cannot access the docstring as an > attribute of a getter, but what did you mean when you said "You need to do > it from the class"? I am still confused - is there a way to get that > docstring or

Re: Splitting of string at an interval

2013-04-07 Thread Dave Angel
On 04/07/2013 04:25 PM, subhabangal...@gmail.com wrote: Dear Group, I was looking to split a string in a particular interval, like, If I have a string, string="The Sun rises in the east of our earth" Are you asserting that there is nothing but letters and whitespace in the string, and that

Splitting of string at an interval

2013-04-07 Thread subhabangalore
Dear Group, I was looking to split a string in a particular interval, like, If I have a string, string="The Sun rises in the east of our earth" I like to see it as, words=["The Sun","rises in","in the","east of","our earth"] If any one of the learned members can kindly suggest. Regards, Sub

Re: __doc__ string for getset members

2013-04-07 Thread Arnaud Delobelle
On 7 April 2013 19:02, Nick Gnedin wrote: > > Folks, > > I am writing an extension where I follow the guide on the web > (http://docs.python.org/3.3/extending/newtypes.html#generic-attribute-management). > I have an object declared, > > struct Object > { > PyObject_HEAD > }; > > and a member s

Re: Error in Python NLTK

2013-04-07 Thread subhabangalore
On Sunday, April 7, 2013 2:14:41 AM UTC+5:30, Dave Angel wrote: > On 04/06/2013 03:56 PM, subhabangal...@gmail.com wrote: > > > Dear Group, > > > > > > I was using a package named NLTK in Python. > > > > > > I was trying to write a code given in section 3.8 of > > > > > > http://docs.huihoo.

Re: Newbie to python. Very newbie question

2013-04-07 Thread Arnaud Delobelle
On 7 April 2013 20:23, Ian Foote wrote: > I'm surprised no one has suggested: > import math sum( x*x for x in range(1, int(math.sqrt(100)), 2)) Yeah! And I'm surprised no one came up with: >>> from itertools import count, takewhile >>> sum(takewhile((100).__gt__, filter((2).__rmod__, m

Re: can anyone help me in developing a simple webpage in jinja2

2013-04-07 Thread Cousin Stanley
Satabdi Mukherjee wrote: > i am a rookie in python and i am trying > to develop a simple webpage using jinja2. > > can anyone please help me how to do that You might try using your jinja template with named tuples # --- from jinja2 import Tem

Re: Newbie to python. Very newbie question

2013-04-07 Thread Ian Foote
On 07/04/13 20:09, Dennis Lee Bieber wrote: On Sun, 7 Apr 2013 04:16:27 -0700 (PDT), ReviewBoard User declaimed the following in gmane.comp.python.general: Hi I am a newbie to python and am trying to write a program that does a sum of squares of numbers whose squares are odd. For example, for

Re: IDE for GUI Designer

2013-04-07 Thread Fabio Zadrozny
Well, I usually use the Qt Designer and it does work well for me. It generates a .ui file with it which has to be passed to pyuic to generate the actual Python code -- and you have to generate a subclass to implement the slots -- for that, I add an external builder to Eclipse, so, in the end it's

Re: I hate you all

2013-04-07 Thread Roy Smith
In article , Ethan Furman wrote: > On 04/07/2013 04:44 AM, Timothy Madden wrote: > > > > I am ok with the people that like python the way it is. > > Really? 'Cause I totally missed that from the subject line... > > -- > ~Ethan~ Take this logically... 1) Ethan hates all clp readers 2) Ethan

Re: I hate you all

2013-04-07 Thread Mark Lawrence
On 05/04/2013 22:41, terminato...@gmail.com wrote: snipped as loads of comments already made. Timothy Madden The BDFL's view from many moons ago www.python.org/doc/essays/ppt/regrets/PythonRegrets.ppt slide 3. -- If you're using GoogleCrap™ please read this http://wiki.python.org/moin/Go

Re: I hate you all

2013-04-07 Thread Ethan Furman
On 04/07/2013 04:44 AM, Timothy Madden wrote: I am ok with the people that like python the way it is. Really? 'Cause I totally missed that from the subject line... -- ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list

__doc__ string for getset members

2013-04-07 Thread Nick Gnedin
Folks, I am writing an extension where I follow the guide on the web (http://docs.python.org/3.3/extending/newtypes.html#generic-attribute-management). I have an object declared, struct Object { PyObject_HEAD }; and a member set through tp_getset mechanism, PyGetSetDef ObjectGetSet[] =

Re: IDE for GUI Designer

2013-04-07 Thread Wolfgang Keller
> Guys, is this, I wonder if there is an IDE with native support for the > development of GUI's A decent Python IDE would probably integrate well enough with any decent GUI builder. If there was one (decent GUI builder). Unfortunately there's afaik currently no GUI builder available for any of th

Re: Newbie to python. Very newbie question

2013-04-07 Thread rusi
On Apr 7, 4:16 pm, ReviewBoard User wrote: > Hi > I am a newbie to python and am trying to write a program that does a > sum of squares of numbers whose squares are odd. > For example, for x from 1 to 100, it generates 165 as an output (sum > of 1,9,25,49,81) > > Here is the code I have > print re

Re: Newbie to python. Very newbie question

2013-04-07 Thread Miki Tebeka
> I am a newbie to python Welcome! I hope you'll do great things with Python. > and am trying to write a program that does a > sum of squares of numbers whose squares are odd. OK. > For example, for x from 1 to 100, it generates 165 as an output (sum > of 1,9,25,49,81) I don't follow, you seem to

Re: new.instancemethod - how to port to Python3

2013-04-07 Thread Helmut Jarausch
On Sun, 07 Apr 2013 11:07:07 +, Steven D'Aprano wrote: > On Sun, 07 Apr 2013 10:54:46 +, Helmut Jarausch wrote: > >> class Foo : >> >> def to_binary(self, *varargs, **keys): >> >>code= ... >>args= ... >># Add function header >>code

Re: new.instancemethod - how to port to Python3

2013-04-07 Thread Helmut Jarausch
On Sun, 07 Apr 2013 10:52:11 +, Steven D'Aprano wrote: > On Sun, 07 Apr 2013 09:50:35 +, Helmut Jarausch wrote: > >> Hi, >> >> I'm trying to port a class to Python3.3 which contains >> >> class Foo : >> >> def to_binary(self, *varargs, **keys): >> >> >

Re: Performance of int/long in Python 3

2013-04-07 Thread Mark Lawrence
On 06/04/2013 22:24, Chris Angelico wrote: On Sat, Apr 6, 2013 at 8:09 PM, Serhiy Storchaka wrote: 04.04.13 00:57, Chris Angelico написав(ла): http://bugs.python.org/issue17629 opened. See also the discussion at http://comments.gmane.org/gmane.comp.python.ideas/15640 . I agree with rejectio

Re: [OT?]gmane not updating

2013-04-07 Thread Chris “Kwpolska” Warrick
On Sat, Apr 6, 2013 at 9:01 PM, Neal Becker wrote: > breamore...@yahoo.co.uk wrote: > >> The gmane site is online but none of the Python lists I subscribe to have >> been >> updated for over 24 hours. I fired off an email yesterday evening to larsi + >> gmane at gnus dot org but I've no idea whe

Re: Help: pickle module unable to load "rb" mode files in linux

2013-04-07 Thread 88888 Dihedral
Surya Kasturi於 2013年4月2日星期二UTC+8下午10時54分25秒寫道: > Hi, hope you can help me on it.. > > > > with open(pickle_f, 'r') as fhand: >         obj = pickle.load(fhand) > > > > > This works on linux but not in windows until  I use "rb" mode while creating > file object. Surprisingly, the "rb" mode i

Re: Help: pickle module unable to load "rb" mode files in linux

2013-04-07 Thread Peter Otten
Surya Kasturi wrote: > I am attaching the file which has to be read.. please take a look into it. > The actual source code can be observed at > https://github.com/scipy/SciPyCentral/blob/master/scipy_central/rest_comments/views.py#L235 > > > when we use "rb" mode in windows, its working. but it

Re: Newbie to python. Very newbie question

2013-04-07 Thread Dave Angel
On 04/07/2013 07:16 AM, ReviewBoard User wrote: Hi I am a newbie to python Then why are you trying to do 7 or 8 things on one line? and am trying to write a program that does a sum of squares of numbers whose squares are odd. For example, for x from 1 to 100, it generates 165 as an output (su

Re: I hate you all

2013-04-07 Thread Timothy Madden
On 07.04.2013 06:00, Dylan Evans wrote: Then you see my point, unless you are being told what to use by a boss then there are plenty of other languages you can choose from. Python is rigid about it's format, that's just what it is and a lot of people like it but if it's not your thing then some o

Re: I hate you all

2013-04-07 Thread Timothy Madden
On 06.04.2013 23:17, Larry Hudson wrote: [...] What you want and what you think are irrelevant. The Python language (whatever version) is already defined. If you want to use it, you have to accept it and adapt to what it is. Live with it and move on. Complaining about it is a complete waste of

Re: Newbie to python. Very newbie question

2013-04-07 Thread Kruno Saho
On Sunday, April 7, 2013 9:16:27 PM UTC+10, ReviewBoard User wrote: > Hi > > I am a newbie to python and am trying to write a program that does a > > sum of squares of numbers whose squares are odd. > > For example, for x from 1 to 100, it generates 165 as an output (sum > > of 1,9,25,49,81) >

Newbie to python. Very newbie question

2013-04-07 Thread ReviewBoard User
Hi I am a newbie to python and am trying to write a program that does a sum of squares of numbers whose squares are odd. For example, for x from 1 to 100, it generates 165 as an output (sum of 1,9,25,49,81) Here is the code I have print reduce(lambda x, y: x+y, filter(lambda x: x%2, map(lambda x:

Re: new.instancemethod - how to port to Python3

2013-04-07 Thread Steven D'Aprano
On Sun, 07 Apr 2013 10:54:46 +, Helmut Jarausch wrote: > class Foo : > > def to_binary(self, *varargs, **keys): > >code= ... >args= ... ># Add function header >code = 'def to_binary(self, %s):\n' % ', '.join(args) + code >exec(c

Re: new.instancemethod - how to port to Python3

2013-04-07 Thread Helmut Jarausch
On Sun, 07 Apr 2013 11:41:46 +0100, Arnaud Delobelle wrote: > On 7 April 2013 10:50, Helmut Jarausch wrote: >> Hi, >> >> I'm trying to port a class to Python3.3 which contains >> >> class Foo : >> >> def to_binary(self, *varargs, **keys): >> >> >> >> self.to

Re: new.instancemethod - how to port to Python3

2013-04-07 Thread Steven D'Aprano
On Sun, 07 Apr 2013 09:50:35 +, Helmut Jarausch wrote: > Hi, > > I'm trying to port a class to Python3.3 which contains > > class Foo : > > def to_binary(self, *varargs, **keys): > > > self.to_binary = new.instancemethod(to_binary, self, self.__class__)

Re: new.instancemethod - how to port to Python3

2013-04-07 Thread Arnaud Delobelle
On 7 April 2013 10:50, Helmut Jarausch wrote: > Hi, > > I'm trying to port a class to Python3.3 which contains > > class Foo : > > def to_binary(self, *varargs, **keys): > > > > self.to_binary = new.instancemethod(to_binary, self, self.__class__) `self` isn'

new.instancemethod - how to port to Python3

2013-04-07 Thread Helmut Jarausch
Hi, I'm trying to port a class to Python3.3 which contains class Foo : def to_binary(self, *varargs, **keys): self.to_binary = new.instancemethod(to_binary, self, self.__class__) # Finally call it manually return apply(self.to_binary, varargs, key

Re: Help: pickle module unable to load "rb" mode files in linux

2013-04-07 Thread Surya Kasturi
I am attaching the file which has to be read.. please take a look into it. The actual source code can be observed at https://github.com/scipy/SciPyCentral/blob/master/scipy_central/rest_comments/views.py#L235 when we use "rb" mode in windows, its working. but its not working in linux system (part

Re: im.py: a python communications tool

2013-04-07 Thread garabik-news-2005-05
Andrew Berg wrote: > On 2013.04.05 20:07, Roy Smith wrote: >> I know this is off-topic, but I encourage people to NOT invent their own >> licenses. > Perhaps he meant this existing license: http://www.wtfpl.net/about/ I like the Python Powered Logo license by Just van Rossum (Guido's brother, in

Re: parse the file

2013-04-07 Thread Dylan Evans
You can read the fantastic manual at http://docs.python.org/2/library/xml.etree.elementtree.html or i'm sure someone will do it for a modest fee. On Sat, Apr 6, 2013 at 3:11 PM, 水静流深 <1248283...@qq.com> wrote: > I have an xml file . http://s.yunio.com/bmCS5h > > It is

Re: Performance of int/long in Python 3

2013-04-07 Thread Steven D'Aprano
On Sat, 06 Apr 2013 19:58:02 -0600, Ian Kelly wrote: > On Sat, Apr 6, 2013 at 7:29 PM, Steven D'Aprano > wrote: >> For some definition of "easily". >> >> if implementation == "CPython": >> if version < "3.3": >> if sys.maxunicode exists: >> use it to decide whether this is

Re: Performance of int/long in Python 3

2013-04-07 Thread Serhiy Storchaka
On 07.04.13 00:24, Chris Angelico wrote: On Sat, Apr 6, 2013 at 8:09 PM, Serhiy Storchaka wrote: See also the discussion at http://comments.gmane.org/gmane.comp.python.ideas/15640 . I agree with rejection. This is an implementation detail and different Python implementations (including future C

Re: Library to work with SSH public keys

2013-04-07 Thread Darren Spruell
On Sat, Apr 6, 2013 at 5:49 AM, Roy Smith wrote: > In article , > Darren Spruell wrote: > >> I'd like to work with user submitted/uploaded SSH public keys from >> Python. I'm trying to solve what I'd thought might be a simple need: >> given a user's OpenSSH formatted _public_ key (RSA, or DSA, o

parse the file

2013-04-07 Thread ????????
I have an xml file. http://s.yunio.com/bmCS5h It is the list of my files in Google-blogger, how can I parse it in python to get every article?please give me the right code,which can get exact result.-- http://mail.python.org/mailman/listinfo/python-list