Re: I am facing an issue while decoding json string using json.loads

2012-12-27 Thread sajuptpm
Hi, Fixed: = urllib.unquote is messing up the JSON. Reverse the order of unquote, and loads, i.e., do a json.loads on the original string, and then urllib.unquote the components that need unquote. Thanks, -- http://mail.python.org/mailman/listinfo/python-list

Re: New to python, do I need an IDE or is vim still good enough?

2012-12-27 Thread Jamie Paul Griffin
* mogul [2012-12-27 12:01:16 -0800]: > 'Aloha! > > I'm new to python, got 10-20 years perl and C experience, all gained on unix > alike machines hacking happily in vi, and later on in vim. > > Now it's python, and currently mainly on my kubuntu desktop. > > Do I really need a real IDE, as the

Re: New to python, do I need an IDE or is vim still good enough?

2012-12-27 Thread Steven D'Aprano
On Thu, 27 Dec 2012 12:01:16 -0800, mogul wrote: > 'Aloha! > > I'm new to python, got 10-20 years perl and C experience, all gained on > unix alike machines hacking happily in vi, and later on in vim. > > Now it's python, and currently mainly on my kubuntu desktop. > > Do I really need a real I

Re: How to get time.strptime()?

2012-12-27 Thread Gnarlodious
Thank you for a reasonable discussion of the problem, although I don't really understand what you said. This is a WSGI webapp configured for one-process and one-thread. I can imagine my unorthodox handling of imported modules is suspect. To explain, my webapp first loads modules from a dict of

Re: learning curve

2012-12-27 Thread Dave Angel
On 12/27/2012 08:20 PM, Verde Denim wrote: > Just getting into Py coding and not understanding why this code doesn't > seem to do anything - Welcome to Python. Can I ask the obvious question? How can this be your first program? Are you just typing it in from somewhere (eg. a book, or a website)

Re: PYTHON 3.3 + GUI + COMPILE

2012-12-27 Thread Kevin Walzer
On 12/27/12 9:08 PM, Dimitrios Xenakis wrote: Morning, I have been looking for a library solution of both GUI and Compiler but for Python 3.3 and ofcourse i was hoping for a combination that would be most compatible between them. After searching i may have concluded to cx_Freeze (because it wa

Re: How to get time.strptime()?

2012-12-27 Thread Ian Kelly
On Thu, Dec 27, 2012 at 5:33 PM, Gnarlodious wrote: > Graham Dumpleton has informed me that the the relevant bug reports are: > > http://bugs.python.org/issue8098 > http://bugs.python.org/issue9260 > > To quote: > > All the problems derive from a stupid function in Python internals called > PyImp

Re: learning curve

2012-12-27 Thread MRAB
On 2012-12-28 01:20, Verde Denim wrote: Just getting into Py coding and not understanding why this code doesn't seem to do anything - # File: dialog2.py import dialog_handler class MyDialog(dialog_handler.Dialog): [snip] # File: dialog_handler.py from Tkinter import * import os class Dialo

Re: learning curve

2012-12-27 Thread alex23
On Dec 28, 11:20 am, Verde Denim wrote: > Just getting into Py coding and not understanding why this code doesn't > seem to do anything - Is that the sum total of your code? You're not showing any instantiation of your classes. -- http://mail.python.org/mailman/listinfo/python-list

learning curve

2012-12-27 Thread Verde Denim
Just getting into Py coding and not understanding why this code doesn't seem to do anything - # File: dialog2.py import dialog_handler class MyDialog(dialog_handler.Dialog): def body(self, master): Label(master, text="First:").grid(row=0) Label(master, text="Second:").grid(row

PYTHON 3.3 + GUI + COMPILE

2012-12-27 Thread Dimitrios Xenakis
Morning, I have been looking for a library solution of both GUI and Compiler but for Python 3.3 and ofcourse i was hoping for a combination that would be most compatible between them. After searching i may have concluded to cx_Freeze (because it was the only one that noticed that currently suppo

Re: New to python, do I need an IDE or is vim still good enough?

2012-12-27 Thread Roy Smith
In article <50dcf145$0$24782$607ed...@cv.net>, "TommyVee" wrote: > Do I really need a real IDE, as the windows guys around me say I do, or will > vim, git, make and other standalone tools make it the next 20 years too for > me? You'll do fine with vim (or emacs, or whatever). You may find an

Re: Finding the name of a function while defining it

2012-12-27 Thread alex23
On Dec 27, 11:31 pm, Steven D'Aprano wrote: > Unfortunately this doesn't help if you actually need the function name > *inside* the function Here's an extension of Steven's original decorator that adds a reference to the function itself into the function's globals, and then composes a new functio

Re: New to python, do I need an IDE or is vim still good enough?

2012-12-27 Thread TommyVee
"mogul" wrote in message news:ea058e5c-518f-4210-b80e-49ae2baab...@googlegroups.com... 'Aloha! I'm new to python, got 10-20 years perl and C experience, all gained on unix alike machines hacking happily in vi, and later on in vim. Now it's python, and currently mainly on my kubuntu desktop.

Re: Finding the name of a function while defining it

2012-12-27 Thread Steven D'Aprano
On Thu, 27 Dec 2012 10:09:01 -0500, Roy Smith wrote: > In article <50dc29e9$0$29967$c3e8da3$54964...@news.astraweb.com>, > Steven D'Aprano wrote: > >> On Wed, 26 Dec 2012 23:46:31 -0800, Abhas Bhattacharya wrote: >> >> >> > two = lamba : "one" >> >> > one = two >> >> >> >> > Which one of thes

Re: How to get time.strptime()?

2012-12-27 Thread Gnarlodious
Graham Dumpleton has informed me that the the relevant bug reports are: http://bugs.python.org/issue8098 http://bugs.python.org/issue9260 To quote: All the problems derive from a stupid function in Python internals called PyImport_ImportModuleNoBlock(). It was designed to avoid lockups of the i

Re: New to python, do I need an IDE or is vim still good enough?

2012-12-27 Thread Chris Angelico
On Fri, Dec 28, 2012 at 7:01 AM, mogul wrote: > Do I really need a real IDE, as the windows guys around me say I do, or will > vim, git, make and other standalone tools make it the next 20 years too for > me? Welcome! No, you don't *need* an IDE. Some people like them and are the more producti

Re: New to python, do I need an IDE or is vim still good enough?

2012-12-27 Thread Cameron Simpson
On 27Dec2012 12:01, mogul wrote: | I'm new to python, got 10-20 years perl and C experience, all gained | on unix alike machines hacking happily in vi, and later on in vim. | | Now it's python, and currently mainly on my kubuntu desktop. | | Do I really need a real IDE, as the windows guys aroun

Re: New to python, do I need an IDE or is vim still good enough?

2012-12-27 Thread Modulok
> 'Aloha! > > I'm new to python, got 10-20 years perl and C experience, all gained on unix > alike machines hacking happily in vi, and later on in vim. > > Now it's python, and currently mainly on my kubuntu desktop. > > Do I really need a real IDE, as the windows guys around me say I do, or will >

Re: Custom alphabetical sort

2012-12-27 Thread Ian Kelly
On Thu, Dec 27, 2012 at 3:17 PM, Terry Reedy wrote: >> PS Py 3.3 warranty: ~30% slower than Py 3.2 > > > Do you have any actual timing data to back up that claim? > If so, please give specifics, including build, os, system, timing code, and > result. There was another thread about this one a whil

Re: Custom alphabetical sort

2012-12-27 Thread Terry Reedy
On 12/27/2012 1:17 PM, wxjmfa...@gmail.com wrote: Le lundi 24 décembre 2012 16:32:56 UTC+1, Pander Musubi a écrit : I would like to sort according to this order: (' ', '.', '\'', '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'A', 'ä', 'Ä', 'á', 'Á', 'â', 'Â', 'à', 'À', 'å', 'Å', '

Re: New to python, do I need an IDE or is vim still good enough?

2012-12-27 Thread Michael Torrie
On 12/27/2012 02:25 PM, Tim Chase wrote: > Alas, one of the worst parts about programming in Python is that I > now find it hard to go back to any of the other languages that I > know. :-) Amen. I find myself wishing for a python-like language for programming Arduino boards. -- http://mail.pyth

Re: New to python, do I need an IDE or is vim still good enough?

2012-12-27 Thread Michael Torrie
On 12/27/2012 01:01 PM, mogul wrote: > Do I really need a real IDE, as the windows guys around me say I do, > or will vim, git, make and other standalone tools make it the next 20 > years too for me? I've never ever used an IDE with Python. With Python I can code for an hour in vim and it runs wi

Re: New to python, do I need an IDE or is vim still good enough?

2012-12-27 Thread Tim Chase
On 12/27/12 14:01, mogul wrote: > Do I really need a real IDE, as the windows guys around me say I > do, or will vim, git, make and other standalone tools make it the > next 20 years too for me? Coding Python (and before that C, Pascal, and even some VB in there) using vi/vim has worked for about

Re: pickle module doens't work

2012-12-27 Thread Terry Reedy
On 12/27/2012 7:34 AM, Dave Angel wrote: Perhaps you'd rather see it in the Python docs. http://docs.python.org/2/library/pickle.html http://docs.python.org/3.3/library/pickle.html pickle can save and restore class instances transpare

Re: New to python, do I need an IDE or is vim still good enough?

2012-12-27 Thread Walter Hurry
On Thu, 27 Dec 2012 12:01:16 -0800, mogul wrote: > 'Aloha! > > I'm new to python, got 10-20 years perl and C experience, all gained on > unix alike machines hacking happily in vi, and later on in vim. > > Now it's python, and currently mainly on my kubuntu desktop. > > Do I really need a real I

Re: Function Parameters

2012-12-27 Thread Oscar Benjamin
On 27 December 2012 20:47, Joseph L. Casale wrote: >> Don't use kwargs for this. List out the arguments in the function >> spec and give the optional ones reasonable defaults. > >> I only use kwargs myself when the set of possible arguments is dynamic >> or unknown. > > Gotch ya, but when the inp

Re: Function Parameters

2012-12-27 Thread Ian Kelly
On Thu, Dec 27, 2012 at 1:47 PM, Joseph L. Casale wrote: >> Don't use kwargs for this. List out the arguments in the function >> spec and give the optional ones reasonable defaults. > >> I only use kwargs myself when the set of possible arguments is dynamic >> or unknown. > > Gotch ya, but when t

Re: New to python, do I need an IDE or is vim still good enough?

2012-12-27 Thread Terry Reedy
On 12/27/2012 3:01 PM, mogul wrote: 'Aloha! I'm new to python, got 10-20 years perl and C experience, all gained on unix alike machines hacking happily in vi, and later on in vim. Now it's python, and currently mainly on my kubuntu desktop. Do I really need a real IDE, as the windows guys arou

RE: Function Parameters

2012-12-27 Thread Joseph L. Casale
> Don't use kwargs for this. List out the arguments in the function > spec and give the optional ones reasonable defaults. > I only use kwargs myself when the set of possible arguments is dynamic > or unknown. Gotch ya, but when the inputs to some keywords are similar, if the function is called

Re: Function Parameters

2012-12-27 Thread Ian Kelly
On Thu, Dec 27, 2012 at 1:16 PM, Joseph L. Casale wrote: > When you use optional named arguments in a function, how do you deal with with > the incorrect assignment when only some args are supplied? > > If I do something like: > > def my_func(self, **kwargs): > > then handle the test cases wit

Re: New to python, do I need an IDE or is vim still good enough?

2012-12-27 Thread Alister
On Thu, 27 Dec 2012 12:01:16 -0800, mogul wrote: > 'Aloha! > > I'm new to python, got 10-20 years perl and C experience, all gained on > unix alike machines hacking happily in vi, and later on in vim. > > Now it's python, and currently mainly on my kubuntu desktop. > > Do I really need a real I

Re: New to python, do I need an IDE or is vim still good enough?

2012-12-27 Thread peter
On 12/27/2012 05:01 PM, mogul wrote: 'Aloha! I'm new to python, got 10-20 years perl and C experience, all gained on unix alike machines hacking happily in vi, and later on in vim. Now it's python, and currently mainly on my kubuntu desktop. Do I really need a real IDE, as the windows guys ar

Function Parameters

2012-12-27 Thread Joseph L. Casale
When you use optional named arguments in a function, how do you deal with with the incorrect assignment when only some args are supplied? If I do something like: def my_func(self, **kwargs): then handle the test cases with: if not kwargs.get('some_key'): raise SyntaxError or:

Re: New to python, do I need an IDE or is vim still good enough?

2012-12-27 Thread Daniel Fetchinson
> I'm new to python, got 10-20 years perl and C experience, all gained on unix > alike machines hacking happily in vi, and later on in vim. > > Now it's python, and currently mainly on my kubuntu desktop. Welcome to the club! > Do I really need a real IDE, as the windows guys around me say I do,

Re: New to python, do I need an IDE or is vim still good enough?

2012-12-27 Thread ian douglas
Some would argue that vim is always good enough, especially with its plugin system. I bounce between vim and Sublime Text 2, and recently bought PyCharm went it went on sale a week ago. -- http://mail.python.org/mailman/listinfo/python-list

Re: regarding compiling the Python 2.7 and 3.3 with mingw

2012-12-27 Thread erikj
Hi, have you been able to resolve this issue for 3.3 ? I've arrived at the same point after applying the patches mentioned here : http://bugs.python.org/issue3754 and creating a custom site.config Thx, Erik On Wednesday, December 26, 2012 1:16:00 AM UTC+1, ginzzer wrote: > Hi all, > > For

New to python, do I need an IDE or is vim still good enough?

2012-12-27 Thread mogul
'Aloha! I'm new to python, got 10-20 years perl and C experience, all gained on unix alike machines hacking happily in vi, and later on in vim. Now it's python, and currently mainly on my kubuntu desktop. Do I really need a real IDE, as the windows guys around me say I do, or will vim, git, ma

RE: Creating an iterator in a class

2012-12-27 Thread Joseph L. Casale
> It's probably best if you use separate cursors anyway. Say you have > two methods with a shared cursor: > > def iter_table_a(self): > self.cursor.execute("SELECT * FROM TABLE_A") > yield from self.cursor > > def iter_table_b(self): > self.cursor.execute("SELECT *

Re: Py 3.3, unicode / upper()

2012-12-27 Thread wxjmfauth
Le jeudi 27 décembre 2012 20:00:37 UTC+1, Serhiy Storchaka a écrit : > On 19.12.12 17:40, Chris Angelico wrote: > > > Interestingly, IDLE on my Windows box can't handle the bolded > > > characters very well... > > > > > s="\U0001d407\U0001d41e\U0001d425\U0001d425\U0001d428, > \U0001d

Re: Command Line Progress Bar

2012-12-27 Thread Oscar Benjamin
On 26 December 2012 06:17, Kevin Anthony wrote: > Hello, > I'm writing a file processing script(Linux), and i would like to have a > progress bar. But i would also like to be able to print messages. Is there > a simple way of doing this without implementing something like ncurses? Other project

Re: 3.2 can't extract tarfile produced by 2.7

2012-12-27 Thread Ian Kelly
On Thu, Dec 27, 2012 at 12:25 PM, Ian Kelly wrote: > You're correct that it makes no sense to open a tar file in binary > mode, Of course that should have read: "it makes no sense to open a tar file in text mode." -- http://mail.python.org/mailman/listinfo/python-list

Re: 3.2 can't extract tarfile produced by 2.7

2012-12-27 Thread Ian Kelly
On Thu, Dec 27, 2012 at 11:50 AM, Steven W. Orr wrote: > Really? I thought that the whole idea of using "rb" or "wb" was something > that was necessitated by WinBlo$e. We're not doing IO on a text file here. > It's a tar file which by definition is binary and it's not clear to me why > unicode has

Re: Password hash

2012-12-27 Thread Peter Pearson
On Sun, 23 Dec 2012 20:38:12 -0600, Robert Montgomery wrote: > I am writing a script that will send an email using an account I set up > in gmail. It is an smtp server using tls on port 587, and I would like > to use a password hash in the (python) script for login rather than > plain text. Is this

Re: Py 3.3, unicode / upper()

2012-12-27 Thread Serhiy Storchaka
On 19.12.12 17:40, Chris Angelico wrote: Interestingly, IDLE on my Windows box can't handle the bolded characters very well... s="\U0001d407\U0001d41e\U0001d425\U0001d425\U0001d428, \U0001d430\U0001d428\U0001d42b\U0001d425\U0001d41d!" print(s) Traceback (most recent call last): File "", li

Re: 3.2 can't extract tarfile produced by 2.7

2012-12-27 Thread Steven W. Orr
On 12/26/2012 11:11 AM, Benjamin Kaplan wrote: On Dec 26, 2012 11:00 AM, "Antoon Pardon" mailto:antoon.par...@rece.vub.ac.be>> wrote: > > I am converting some programs to python 3. These programs manipulate tarfiles. In order for the python3 programs to be really useful > they need to be able

Re: Creating an iterator in a class

2012-12-27 Thread Ian Kelly
On Thu, Dec 27, 2012 at 7:44 AM, Joseph L. Casale wrote: > I am writing a class to provide a db backed configuration for an application. > > In my programs code, I import the class and pass the ODBC params to the > class for its __init__ to instantiate a connection. > > I would like to create a fu

Re: Custom alphabetical sort

2012-12-27 Thread wxjmfauth
Le lundi 24 décembre 2012 16:32:56 UTC+1, Pander Musubi a écrit : > Hi all, > > > > I would like to sort according to this order: > > > > (' ', '.', '\'', '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', > 'A', 'ä', 'Ä', 'á', 'Á', 'â', 'Â', 'à', 'À', 'å', 'Å', 'b', 'B', 'c', 'C',

Re: Regarding Jython support in IBM and HP platforms

2012-12-27 Thread Kev Dwyer
Naresh Kumar wrote: > > > > Hello, > > I am trying to use the Jython in IBM AIX and HP machines to test our > framework which is based on JAVA. when trying to run our python and jython > based testcases using system test framework we are getting below errors in > jython.err file > > > > Err

RE: Creating an iterator in a class

2012-12-27 Thread Joseph L. Casale
>Have the method yield instead of returning: Thanks, that was simple, I was hung up on implementing magic methods. Thanks for the pointers guys! jlc -- http://mail.python.org/mailman/listinfo/python-list

ImportError: /usr/local/lib/python3.2/dist-packages/OpenSSL/SSL.cpython-32mu.so: undefined symbol: SSLv2_method

2012-12-27 Thread Jason Friedman
Hello, I downloaded: https://launchpad.net/pyopenssl/main/0.11/+download/pyOpenSSL-0.11.tar.gz Then: $ python3 setup.py build $ sudo python3 setup.py install Then: $ python3 -c "from OpenSSL import SSL" Traceback (most recent call last): File "", line 1, in File "OpenSSL/__init__.py", line 4

Re: Creating an iterator in a class

2012-12-27 Thread TommyVee
"Joseph L. Casale" wrote in message news:mailman.1346.1356619576.29569.python-l...@python.org... I am writing a class to provide a db backed configuration for an application. In my programs code, I import the class and pass the ODBC params to the class for its __init__ to instantiate a conne

Re: Creating an iterator in a class

2012-12-27 Thread Peter Otten
Joseph L. Casale wrote: > I am writing a class to provide a db backed configuration for an > application. > > In my programs code, I import the class and pass the ODBC params to the > class for its __init__ to instantiate a connection. > > I would like to create a function to generically access

Re: Finding the name of a function while defining it

2012-12-27 Thread Roy Smith
In article <50dc29e9$0$29967$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > On Wed, 26 Dec 2012 23:46:31 -0800, Abhas Bhattacharya wrote: > > >> > two = lamba : "one" > >> > one = two > >> > >> > Which one of these is the "name" of the function? > [...] > > If i call one() and t

Creating an iterator in a class

2012-12-27 Thread Joseph L. Casale
I am writing a class to provide a db backed configuration for an application. In my programs code, I import the class and pass the ODBC params to the class for its __init__ to instantiate a connection. I would like to create a function to generically access a table and provide an iterator. How do

Re: Finding the name of a function while defining it

2012-12-27 Thread Steven D'Aprano
On Thu, 27 Dec 2012 07:32:16 -0600, Tim Chase wrote: > Depending on where in the code you are, the same function object also > has a local name of "fn". It's madness until you understand it, and > then it's beauty :) "This is madness!" "No, this is PYTHON!!!" -- Steven -- http://mail.pytho

Re: Finding the name of a function while defining it

2012-12-27 Thread Steven D'Aprano
On Tue, 25 Dec 2012 18:00:38 -0800, Abhas Bhattacharya wrote: > While I am defining a function, how can I access the name (separately as > string as well as object) of the function without explicitly naming > it(hard-coding the name)? For eg. I am writing like: > def abc(): > #how do i access

Re: Finding the name of a function while defining it

2012-12-27 Thread Tim Chase
On 12/27/12 04:58, Steven D'Aprano wrote: > On Wed, 26 Dec 2012 23:46:31 -0800, Abhas Bhattacharya wrote: > two = lamba : "one" one = two >>> Which one of these is the "name" of the function? > [...] >> If i call one() and two() respectively, i would like to see "one" and >> "two".

Re: Require help migrating from Perl to Python 2.7 (namespaces)

2012-12-27 Thread alex23
On 27 Dec, 22:58, Chris Angelico wrote: > Rick, ever heard of the ELIZA Effect? Can we _please_ stop feeding this troll? -- http://mail.python.org/mailman/listinfo/python-list

Re: pickle module doens't work

2012-12-27 Thread Chris Angelico
On Fri, Dec 28, 2012 at 12:16 AM, Omer Korat wrote: > I see. In that case, all I have to do is make sure NLTK is available when I > load the pickled objects. That pretty much solves my problem. Thanks! > So it means pickle doesn't ever save the object's values, only how it was > created? > > Say

Re: pickle module doens't work

2012-12-27 Thread Omer Korat
I see. In that case, all I have to do is make sure NLTK is available when I load the pickled objects. That pretty much solves my problem. Thanks! So it means pickle doesn't ever save the object's values, only how it was created? Say I have a large object that requires a lot of time to train on

Re: Finding the name of a function while defining it

2012-12-27 Thread Steven D'Aprano
On Tue, 25 Dec 2012 22:11:28 -0500, Roy Smith wrote: > I've only ever wanted the name. If you need the actual function object, > I suppose you might eval() the name, or something like that. Oh look, I found a peanut! Let me get a 50lb sledgehammer to crack it open! *wink* Please do not use ev

Re: [Newbie] Require help migrating from Perl to Python 2.7 (namespaces)

2012-12-27 Thread Chris Angelico
On Thu, Dec 27, 2012 at 5:50 PM, Ranting Rick wrote: > Every keyword, syntactical structure, style, etc, etc, should be based > on logical foundations; not adolescent fads or propagating more > idiotic cultural traditions. You piss and moan about language X and > how asinine the language is, them

Re: pickle module doens't work

2012-12-27 Thread Dave Angel
On 12/27/2012 07:05 AM, Omer Korat wrote: > You're probably right in general, for me the 3.3 and 2.7 pickles definitely > don't work the same: > > 3.3: type(pickle.dumps(1)) > > > 2.7: type(pickle.dumps(1, pickle.HIGHEST_PROTOCOL)) > That is the same. In 2.7, str is made up of bytes,

Re: pickle module doens't work

2012-12-27 Thread Omer Korat
You're probably right in general, for me the 3.3 and 2.7 pickles definitely don't work the same: 3.3: >>> type(pickle.dumps(1)) 2.7: >>> type(pickle.dumps(1, pickle.HIGHEST_PROTOCOL)) As you can see, in 2.7 when I try to dump something, I get useless string. Look what I gen when I dump an N

Re: pickle module doens't work

2012-12-27 Thread Peter Otten
Omer Korat wrote: > I'm working on a project in Python 2.7. I have a few large objects, and I > want to save them for later use, so that it will be possible to load them > whole from a file, instead of creating them every time anew. It is > critical that they be transportable between platforms. P

Re: Finding the name of a function while defining it

2012-12-27 Thread Steven D'Aprano
On Wed, 26 Dec 2012 23:46:31 -0800, Abhas Bhattacharya wrote: >> > two = lamba : "one" >> > one = two >> >> > Which one of these is the "name" of the function? [...] > If i call one() and two() respectively, i would like to see "one" and > "two". I'm afraid you're going to be disappointed. There

Re: A strange questions, about socket.py

2012-12-27 Thread Chaojie He
I made a mistake,Sorry -- http://mail.python.org/mailman/listinfo/python-list

A strange questions, about socket.py

2012-12-27 Thread Chaojie He
Code: import urllib2 , socks , socket socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5,'127.0.0.1',1080,True,None,None) socket.socket = socks.socksocket result = urllib2.urlopen("http://www.youtube.com",timeout=5) If in the operation process of the server disconnected, the script will enter circulat

pickle module doens't work

2012-12-27 Thread Omer Korat
Hi all, I'm working on a project in Python 2.7. I have a few large objects, and I want to save them for later use, so that it will be possible to load them whole from a file, instead of creating them every time anew. It is critical that they be transportable between platforms. Problem is, when

Re: Finding the name of a function while defining it

2012-12-27 Thread Mitya Sirenef
On 12/27/2012 03:26 AM, Abhas Bhattacharya wrote: On Thursday, 27 December 2012 13:33:34 UTC+5:30, Mitya Sirenef wrote: How about defining a function that prints value and then calls a function? def call(func_name): print(mydict[func_name]) globals()[func_name]() You could als

Re: Finding the name of a function while defining it

2012-12-27 Thread Chris Rebert
On Dec 26, 2012 11:55 PM, "Abhas Bhattacharya" wrote: > > On Thursday, 27 December 2012 10:22:15 UTC+5:30, Tim Roberts wrote: > > Abhas Bhattacharya wrote: > > [Oh god please stop/avoid using Google Groups with its godawful reply-quoting style that adds excessive blank lines] > > >While I am def

Re: Finding the name of a function while defining it

2012-12-27 Thread Abhas Bhattacharya
On Thursday, 27 December 2012 13:56:24 UTC+5:30, Chris Rebert wrote: > On Dec 25, 2012 6:06 PM, "Abhas Bhattacharya" wrote: > > > > > > While I am defining a function, how can I access the name (separately as > > string as well as object) of the function without explicitly naming > > it(hard-

Re: Finding the name of a function while defining it

2012-12-27 Thread Chris Rebert
On Dec 25, 2012 6:06 PM, "Abhas Bhattacharya" wrote: > > While I am defining a function, how can I access the name (separately as string as well as object) of the function without explicitly naming it(hard-coding the name)? > For eg. I am writing like: > def abc(): > #how do i access the funct

Re: Finding the name of a function while defining it

2012-12-27 Thread Abhas Bhattacharya
On Thursday, 27 December 2012 13:33:34 UTC+5:30, Mitya Sirenef wrote: > > How about defining a function that prints value and then calls a function? > > > > def call(func_name): > >print(mydict[func_name]) > >globals()[func_name]() > > > > > > You could also define a custom clas

Re: Finding the name of a function while defining it

2012-12-27 Thread Mitya Sirenef
On 12/27/2012 02:45 AM, Abhas Bhattacharya wrote: On Thursday, 27 December 2012 10:22:15 UTC+5:30, Tim Roberts wrote: Abhas Bhattacharya wrote: While I am defining a function, how can I access the name (separately as string as well as object) of the function without explicitly naming it(hard

Re: Finding the name of a function while defining it

2012-12-27 Thread Chris Angelico
On Thu, Dec 27, 2012 at 6:46 PM, Abhas Bhattacharya wrote: > [ a whole lot of double-spaced quoted text - please trim it ] > If i call one() and two() respectively, i would like to see "one" and "two". That completely goes against your idea of knowing at compile-time, because the name "two" isn't

Re: Finding the name of a function while defining it

2012-12-27 Thread Abhas Bhattacharya
On Thursday, 27 December 2012 13:22:45 UTC+5:30, Chris Angelico wrote: > On Thu, Dec 27, 2012 at 6:46 PM, Abhas Bhattacharya > > wrote: > > > [ a whole lot of double-spaced quoted text - please trim it ] > > > If i call one() and two() respectively, i would like to see "one" and "two". > > >

Re: Simple audio library

2012-12-27 Thread Abhas Bhattacharya
On Wednesday, 26 December 2012 09:46:10 UTC+5:30, Xantipius wrote: > On Dec 26, 5:07 am, Abhas Bhattacharya > > wrote: > > > Which simple python audio library will you suggest for low level audio > > creation (for eg I want to create tones of different intensities and > > frequency continousl