-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Hi,
I was playing around with different ways to
simulate what atexit does and found this very interesting
use-case with weak references.
import weakref
class C: pass
def goodbye(param):
print 'Bye.',param
x=weakref.ref(C, goodbye)
if
Shabda Raaj sha...@agiliq.com writes:
I'd expect it to be False. There will be a small amount of time between
the two invocations and the time will change
Ok, that makes sense. Should have written a better test case. What about
this.
datetime.datetime(2013, 1, 1) == datetime.date(2013, 1,
On Tue, Sep 10, 2013 at 10:45 AM, Noufal Ibrahim nou...@nibrahim.net.inwrote:
Anand Chitipothu anandol...@gmail.com writes:
[...]
I use it very often. Here is my random-password script.
[...]
I use mkpasswd(1) :)
What ever you use, please use py-bcrypt or something similar before you
Noufal Ibrahim nou...@nibrahim.net.in writes:
Shabda Raaj sha...@agiliq.com writes:
I'd expect it to be False. There will be a small amount of time between
the two invocations and the time will change
Ok, that makes sense. Should have written a better test case. What about
this.
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On Tuesday 10 September 2013 10:57 AM, Shabda Raaj wrote:
A variable is either local or global. It is decided at the
compile time.
Erm, compile?
Python's scoping rules are , erm, interesting:
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On Tuesday 10 September 2013 11:30 AM, Anand B Pillai wrote:
Don't advise anyone to use this code - it is just to illustrate
the one of the ways in which weak references can be used. In
general it is better not to rely on the order of gc in your
On Tue, Sep 10, 2013 at 11:10 AM, Bibhas m...@bibhas.in wrote:
Only the scripts that have been imported somewhere. Right?
Not necessarily -
import py_compile
py_compile.compile
Byte-compile one Python source file to Python bytecode.
Arguments:
file:source filename
Anand B Pillai anandpil...@letterboxes.org wrote:
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On Tuesday 10 September 2013 10:57 AM, Shabda Raaj wrote:
A variable is either local or global. It is decided at the
compile time.
Erm, compile?
Python's scoping rules are , erm,
Of course it is possible to force byte-compile the Python scripts. You can also
use 'pycompile' command for that. I meant python by default byte-compiles the
scripts that are imported so that they can be imported faster the next time.
Jeffrey Jose jeffjosej...@gmail.com wrote:
On Tue, Sep 10,
See this:
In [3]: OrderedDict(a=1) == {a: 1}
Out[3]: True
Today (10/Sep) is not equal to right now (10/Sep, 11:28 am).
Makes sense no?
True, but datetime.date(2013, 1, 1) == datetime.datetime(2013, 1, 1)
should still get me true. (The argument being, date.__eq__ should
only care about the
Shabda Raaj sha...@agiliq.com writes:
See this:
In [3]: OrderedDict(a=1) == {a: 1}
Out[3]: True
Today (10/Sep) is not equal to right now (10/Sep, 11:28 am).
Makes sense no?
True, but datetime.date(2013, 1, 1) == datetime.datetime(2013, 1, 1)
should still get me true. (The argument
On Tue, Sep 10, 2013 at 11:10 AM, Bibhas m...@bibhas.in wrote:
Anand Chitipothu anandol...@gmail.com wrote:
On Tue, Sep 10, 2013 at 10:57 AM, Shabda Raaj sha...@agiliq.com
wrote:
A variable is either local or global. It is decided at the compile
time.
Erm, compile?
well, you
On Tue, Sep 10, 2013 at 11:43 AM, Anand B Pillai
anandpil...@letterboxes.org wrote:
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On Tuesday 10 September 2013 11:30 AM, Anand B Pillai wrote:
Don't advise anyone to use this code - it is just to illustrate
the one of the ways in which
Anand Chitipothu anandol...@gmail.com writes:
[...]
You can also achieve the same using __del__.
class Foo:
def __del__(self):
print on exit
foo = Foo()
if __name__ == '__main__':
print 3+4
print 8+9
This whole business is kind of surreptitious.
The PyODE
On Tue, Sep 10, 2013 at 12:13 PM, Noufal Ibrahim nou...@nibrahim.net.inwrote:
[...]
This whole business is kind of surreptitious.
The PyODE library had a world object which can hold multiple
geometries in it. Once you add it to the world, you expect it to keep
track of the geometries.
Anand Chitipothu anandol...@gmail.com writes:
[...]
Isn't that the job of PyODE library to keep track objects in the world by
adding them to a list or something?
I'd expect so.
If I say something like world.add_geometry(obj), it should keep track of
it. But for some obscure reason, it
I can give a few answers for you:
1. The desires of minorities tend to be poorly served in
rule-by-majority groups like democracies and anarchic mobs.
2. Being a minority (e.g. woman; expatriate) can be an unpleasant and
alienating experience. Humans are social mammals who seek out the
My first random password (until it is replaced with SHA, MD5, bCrypt,
whatever):
str(random.random())[2:]
'742557965797'
On Tue, Sep 10, 2013 at 11:34 AM, Vinayak Hegde vinay...@gmail.com wrote:
On Tue, Sep 10, 2013 at 10:45 AM, Noufal Ibrahim nou...@nibrahim.net.in
wrote:
Anand
Jonathan,
Thanks for the answer. The points you raised make sense for a support
group (IMO) but not for a technical community (especially mailing list
where even your geographical location is immaterial.)
*I *couldn't find answer to this question (easily) on
http://www.pyladies.com/ either.
On
Both Shabda and Nouful used the term prefer
Is there a best practice ?
http://stackoverflow.com/questions/4984647/accessing-dict-keys-like-an-attribute-in-python
This guy asked for pitfalls and caveats - but no one seem to have
addressed the question (There are several answers about How to do it
On Sun, Sep 8, 2013 at 11:28 PM, Mandar Vaze / मंदार वझे
mandarv...@gmail.com wrote:
before, and I would be interested in your response:
What purpose is served by creating a women's group, instead of
joining the existing group thus making it more diverse?
In other words, what purpose is
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On Tuesday 10 September 2013 02:32 PM, Mandar Vaze / मंदार वझे wrote:
Jonathan,
Thanks for the answer. The points you raised make sense for a
support group (IMO) but not for a technical community (especially
mailing list where even your
On Tue, Sep 10, 2013 at 2:40 PM, sankarshan foss.mailingli...@gmail.comwrote:
On Sun, Sep 8, 2013 at 11:28 PM, Mandar Vaze / मंदार वझे
mandarv...@gmail.com wrote:
before, and I would be interested in your response:
What purpose is served by creating a women's group, instead of
joining
Please co-operate. If you really have to talk about it, keep your
conversations private.
Some people object to private discussions :)
-Mandar
___
BangPypers mailing list
BangPypers@python.org
https://mail.python.org/mailman/listinfo/bangpypers
Anand B Pillai anandpil...@letterboxes.org writes:
[...]
This is kind of continuing the original thread's context in disguise.
Let us have healthy discussions fresh, so request to not post further
on rekindling a closed thread.
Please co-operate. If you really have to talk about it, keep
This thread is awesome. Keep them coming. :)
I've also been using random string generator Shabda posted for a long
time. Handy.
On Tuesday 10 September 2013 12:48 PM, Lakshman Prasad wrote:
My first random password (until it is replaced with SHA, MD5, bCrypt,
whatever):
Don't know if I can call it a snippet, But this command on terminal -
$ python -m SimpleHTTPServer 8080
is really handy for sharing files(along with the use of `localtunnel`
maybe) and testing HTML/CSS.
On Tuesday 10 September 2013 12:48 PM, Lakshman Prasad wrote:
My first random password
Me@Bibhas m...@bibhas.in writes:
Don't know if I can call it a snippet, But this command on terminal -
$ python -m SimpleHTTPServer 8080
Similar but less well known.
Command line ftp client (similar to ftp(1))
python -m ftplib ftp.gnu.org
Command line mail client (similar to mail(1)) but
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On Tuesday 10 September 2013 03:07 PM, Me@Bibhas wrote:
This thread is awesome. Keep them coming. :)
I've also been using random string generator Shabda posted for a
long time. Handy.
On Tuesday 10 September 2013 12:48 PM, Lakshman Prasad
Hi,
I am trying to dynamically import classes create instances of those
classes.
Can you suggest me some examples links.
Regards,
Jagan
___
BangPypers mailing list
BangPypers@python.org
https://mail.python.org/mailman/listinfo/bangpypers
Thanks Jonathan, Sankarshan for your support. I prefer to work than argue
with some people.
I do not want to carry this thread forward.
Warm regards,
Anu
On Tue, Sep 10, 2013 at 2:54 PM, Noufal Ibrahim nou...@nibrahim.net.inwrote:
Anand B Pillai anandpil...@letterboxes.org writes:
[...]
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On Tuesday 10 September 2013 03:28 PM, Noufal Ibrahim wrote:
Me@Bibhas m...@bibhas.in writes:
Don't know if I can call it a snippet, But this command on
terminal -
$ python -m SimpleHTTPServer 8080
Similar but less well known.
Command
Hi Jagan,
This should be of your interest :
http://pyvideo.org/video/1707/how-import-works
Regards
Konark
On Tue, Sep 10, 2013 at 3:36 PM, Vaikuntham Jagannath
vjagannat...@gmail.com wrote:
Hi,
I am trying to dynamically import classes create instances of those
classes.
Can you
Another tip:
Its common to write decorators which clober the docstring and other meta
data. If you use functools.wrap this metadata is preserved.
http://docs.python.org/2/library/functools.html
https://github.com/django/django/blob/master/django/contrib/auth/decorators.py#L19
On Tue, Sep 10,
Command line json formatter
$ echo '{name: Bangpypers, location: Bangalore}' | python -m
json.tool
On Tue, Sep 10, 2013 at 3:28 PM, Noufal Ibrahim nou...@nibrahim.net.inwrote:
Me@Bibhas m...@bibhas.in writes:
Don't know if I can call it a snippet, But this command on terminal -
$ python
You can probably have a look in the below link
- http://docs.python.org/2/library/functions.html#__import__
On Tue, Sep 10, 2013 at 3:36 PM, Vaikuntham Jagannath
vjagannat...@gmail.com wrote:
Hi,
I am trying to dynamically import classes create instances of those
classes.
Can you
Not all keys in the dictionary can be expressed as attributes. Attributes
has to follow the naming conventions.
I had problems with user generated 'keys', JSON supported keys.
On Tue, Sep 10, 2013 at 2:41 PM, Mandar Vaze / मंदार वझे
mandarv...@gmail.com wrote:
Both Shabda and Nouful
What would happen for a dictionary like this?
d = {'1': 'foo', 1: 'bar'}
d
{'1': 'foo', 1: 'bar'}
On Tuesday 10 September 2013 10:00 AM, Noufal Ibrahim wrote:
Shabda Raaj sha...@agiliq.com writes:
http://code.activestate.com/recipes/52308-the-simple-but-handy-collector-of-a-bunch-of-named/
Date: Tue, 10 Sep 2013 15:39:44 +0530
From: Vineet Naik naik...@gmail.com
To: Bangalore Python Users Group - India bangpypers@python.org
Message-ID:
CADmbCiP8Dq7BroEWovreG2AfB=
g1u3z80zgnt6cg3lenrsb...@mail.gmail.com
Content-Type: text/plain; charset=ISO-8859-1
Command line json
echo '{name: Bangpypers, location: Bangalore}' | python -m json.tool
In this command, what is this json.tool ?
I could not find tool in dir(json)
import json
dir(json)
['JSONDecoder', 'JSONEncoder', '__all__', '__author__', '__builtins__',
'__doc__', '__file__', '__name__', '__package__',
Saju M sajup...@gmail.com writes:
echo '{name: Bangpypers, location: Bangalore}' | python -m json.tool
In this command, what is this json.tool ?
I could not find tool in dir(json)
import json
dir(json)
['JSONDecoder', 'JSONEncoder', '__all__', '__author__', '__builtins__',
'__doc__',
On Tue, Sep 10, 2013 at 4:16 PM, Saju M sajup...@gmail.com wrote:
echo '{name: Bangpypers, location: Bangalore}' | python -m
json.tool
In this command, what is this json.tool ?
I could not find tool in dir(json)
import json
dir(json)
['JSONDecoder', 'JSONEncoder', '__all__',
On Tuesday 10 September 2013 04:16 PM, Saju M wrote:
echo '{name: Bangpypers, location: Bangalore}' | python -m json.tool
In this command, what is this json.tool ?
I could not find tool in dir(json)
import json
dir(json)
['JSONDecoder', 'JSONEncoder', '__all__', '__author__',
Vineet Naik naik...@gmail.com writes:
[...]
If you are using jedi[1] with auto-complete in emacs, C-. takes you to
the definition by opening the module file in a write protected
buffer. I use jedi mainly for this feature and inline documentation
popout rather than for autocomplete :-)
Hi,
I have couple of doubts
* How do you find json has module named tool ?.
* Why dir(json) not showing tool ??
import json
dir(json)
['JSONDecoder', 'JSONEncoder', '__all__', '__author__', '__builtins__',
'__doc__', '__file__', '__name__', '__package__', '__path__',
'__version__',
Saju M sajup...@gmail.com writes:
Hi,
I have couple of doubts
* How do you find json has module named tool ?.
I look at the code/docs.
* Why dir(json) not showing tool ??
Because of the __all__ variable in the module.
http://docs.python.org/2/tutorial/modules.html
import json
On Tue, Sep 10, 2013 at 4:48 PM, Saju M sajup...@gmail.com wrote:
Hi,
I have couple of doubts
* How do you find json has module named tool ?.
* Why dir(json) not showing tool ??
import json
dir(json)
['JSONDecoder', 'JSONEncoder', '__all__', '__author__', '__builtins__',
'__doc__',
Another utility script that I use very heavily, pyvi.
https://github.com/anandology/hacks/blob/master/pyvi
$ pyvi json.tool
That opens json.tool module (or any other module) in vim. It also changes
the current dir to that module directory so that you can easily open other
modules in the same
I personally like to use IPython.
To see all variables, constants, modules.
n [9]: import requests
In [10]: requests.
requests.ConnectionError requests.api requests.models
requests.HTTPError requests.auth requests.options
requests.NullHandler
This thread is awesome. Keep them coming. :)
Prettyprint comes very handy when it comes to object debugging. Use it in my
logger method always ;)
http://docs.python.org/2/library/pprint.html
___
BangPypers mailing list
BangPypers@python.org
Obligatory comic: https://xkcd.com/936/
On 10 September 2013 10:42, Anand Chitipothu anandol...@gmail.com wrote:
On Tue, Sep 10, 2013 at 10:39 AM, Shabda Raaj sha...@agiliq.com wrote:
https://github.com/webpy/webpy/blob/master/web/utils.py#L52
Wow, thats better than the bare bunch
I personally like to use IPython.
To see all variables, constants, modules.
Ipython is amazing. To see a library code, I jsut tab-out lib_name.__file__
and then
!vim paste_the_file_path
Going to add something like anand's pyvi to ipy_user_conf.py.
Ipython with treat anything after bang(!)
Bibhas,
Glad you are pleased.
I started the thread in consideration of your comment that list had not enough
interesting being posted.
Again, it is ok to start threads yourself (so keep something to throw out there
maybe when current flurry slows down and the list needs some fresh discussion).
Ignoring classes for the moment, how likely do you think you would
have a dict like that :)
On a separate note if you are using primitive types, I cannot think of
any scenarios, where not coercing keys to be of the same type would be
considered inappropriate (except in case of reverse dicts)
On
I'm just curious. I faced a similar issue before while answering a
question about Django on StackOverflow. Django turns context variable
dictionaries into objects with attributes in template. So in one
question in SO someone posted this question. Had to answer that Django
doesn't really support
Attributes are stylish, readable, feel native as object compared to
dictionary. Sometimes I use setter methods to override the default
assignments, modify getter to format the values and getter for virtual
attributes for DSL stuffs.
class DictObj(dict):
def __getattr__(self, key):
if
We must be thankful for the people who invented the keyboard and stopped
with single SPACE and TAB keys for column indentation.
Every time you edit, mind compile the Python code on production critical
time, there could be a landmine hidden in the white space on nano or remote
vi.
On Tue, Sep
Dear All,
Kenneth Love has agreed to hold a mentoring sessions for Pyladies
Bangalore.
Before I talk about the sessions, I would like to introduce y'all to
Kenneth Love. He is a self taught programmer who learnt a lot of things on
his own. More importantly, he is a Django guru. Read more about
On Tue, Sep 10, 2013 at 11:02 PM, Annapoornima Koppad a.kop...@gmail.comwrote:
Dear All,
Kenneth Love has agreed to hold a mentoring sessions for Pyladies
Bangalore.
As for the mentoring sessions, we are at Indian standard time (12.5 hours
before Kenneth) and he is on the PST(US West
59 matches
Mail list logo