Re: [BangPypers] about python code

2014-11-20 Thread Jeffrey Jose
The default one works for almost all purposes. If you are feeling
adventurous, try ipython

-jeff
On Nov 20, 2014 9:49 AM, narayan naik narayannaik...@gmail.com wrote:

 Ya, am talking the same
  On 19 Nov 2014 18:49, Martin Anto info.martina...@gmail.com wrote:

  Simulator??
 
  You mean interpreter?
  On Nov 19, 2014 2:48 PM, narayan naik narayannaik...@gmail.com
 wrote:
 
   hi,
  can any one tell,which simulator is best for python
  
   On Mon, Nov 17, 2014 at 4:26 PM, narayan naik 
 narayannaik...@gmail.com
   wrote:
  
hi
 can you please send me the required terminal package
   
On Mon, Nov 17, 2014 at 2:36 PM, Vikneshwaren 
  vikneshware...@gmail.com
wrote:
   
I think your code imports OpenCV module and seems to be that it was
  not
properly imported or the module is completely missing. Please check
  into
that and try installing the module if missing.
   
--
Vikneshwaren
Free Software Foundation, Tamil Nadu
On Nov 17, 2014 2:30 PM, narayan naik narayannaik...@gmail.com
   wrote:
   
 hi,
when I am running face detection code ,I am getting this error.

 Traceback (most recent call last):
   File /home/nv/read.py, line 2, in module
 import cv2
 ImportError: No module named cv2
 

 please help me.
 ___
 BangPypers mailing list
 BangPypers@python.org
 https://mail.python.org/mailman/listinfo/bangpypers

___
BangPypers mailing list
BangPypers@python.org
https://mail.python.org/mailman/listinfo/bangpypers
   
   
   
   ___
   BangPypers mailing list
   BangPypers@python.org
   https://mail.python.org/mailman/listinfo/bangpypers
  
  ___
  BangPypers mailing list
  BangPypers@python.org
  https://mail.python.org/mailman/listinfo/bangpypers
 
 ___
 BangPypers mailing list
 BangPypers@python.org
 https://mail.python.org/mailman/listinfo/bangpypers

___
BangPypers mailing list
BangPypers@python.org
https://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] Mailing list etiquette

2014-08-04 Thread Jeffrey Jose
I agree with almost all of it, except for these 2.

1. No HTML emails
2. No attachments.

These are surely relics from the past. I dont see any reason why these need
to be valid anymore. If your answer to this is my favorite ncurses client
cant read it it doesnt count.

-jeff


On Mon, Aug 4, 2014 at 11:47 AM, Kushal Das kushal...@gmail.com wrote:

 Good old presentation [1] from mbuf. Please take time to read and
 understand.

 [1]
 http://www.shakthimaan.com/downloads/glv/presentations/mailing-list-etiquette.pdf

 Kushal
 --
 CPython Core Developer
 http://fedoraproject.org
 http://kushaldas.in
 ___
 BangPypers mailing list
 BangPypers@python.org
 https://mail.python.org/mailman/listinfo/bangpypers

___
BangPypers mailing list
BangPypers@python.org
https://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] Mailing list etiquette

2014-08-04 Thread Jeffrey Jose
On Mon, Aug 4, 2014 at 8:13 PM, Anand Chitipothu anandol...@gmail.com
wrote:


 On Mon, Aug 4, 2014 at 2:23 PM, Noufal Ibrahim KV nou...@nibrahim.net.in
 wrote:

 On Mon, Aug 04 2014, Jeffrey Jose wrote:

  I agree with almost all of it, except for these 2.
 
  1. No HTML emails

 I don't like HTML emails because usual textual matter doesn't need
 it. It simply bloats things and if the renderer your client is using
 doesn't have some feature that the sender uses, it'll appear broken.


 I agree. We don't need HTML emails.



​Interesting point. Although along the expected lines.


  2. No attachments.

 This makes sense for a list because, as I understand it, the list server
 has to send a copy of the attachment to everyone on the list. It's an
 avoidable expense. A lot simpler to send a link to something on dropbox
 or somewhere.


 Not only that, it is a pain to download something and open it in some
 application just to know what is inside. It is a lot better to send a link
 instead of sending attachments.


​I hate just as much as you to touch the mouse when I'm working, but that
said I wonder in the rapidly changing new world of development (read:
github) how much of these we're used to this way, so lets continue that
will survive.

email etiquette are about respect. Respect to the person receiving your
email. I get it.
That said, I do think the whole mailing list culture will go away in the
future.

I dont know what it is, but maybe someone reading this will create a better
(and more relevant) alternative.



 Anand

___
BangPypers mailing list
BangPypers@python.org
https://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] Mailing list etiquette

2014-08-04 Thread Jeffrey Jose
On Mon, Aug 4, 2014 at 2:23 PM, Noufal Ibrahim KV nou...@nibrahim.net.in
wrote:

 On Mon, Aug 04 2014, Jeffrey Jose wrote:

  I agree with almost all of it, except for these 2.
 
  1. No HTML emails

 I don't like HTML emails because usual textual matter doesn't need
 it. It simply bloats things and if the renderer your client is using
 doesn't have some feature that the sender uses, it'll appear broken.


​I'm curious how do you read your mails? Noufal, if my memory serves me
right you're an emacs person. So emacs perhaps?

I'm in the vim camp, so I use my browser for email.​


  2. No attachments.

 This makes sense for a list because, as I understand it, the list server
 has to send a copy of the attachment to everyone on the list. It's an
 avoidable expense. A lot simpler to send a link to something on dropbox
 or somewhere.
 [...]


 ​.. and since I use browser, I appreciate an email that's nicely
formatted. Yes, that includes contextual information with embedded images.​



 --
 Cordially,
 Noufal
 http://nibrahim.net.in

___
BangPypers mailing list
BangPypers@python.org
https://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] Mailing list etiquette

2014-08-04 Thread Jeffrey Jose
On Mon, Aug 4, 2014 at 8:13 PM, Anand Chitipothu anandol...@gmail.com
wrote:


 On Mon, Aug 4, 2014 at 2:23 PM, Noufal Ibrahim KV nou...@nibrahim.net.in
 wrote:

 On Mon, Aug 04 2014, Jeffrey Jose wrote:

  I agree with almost all of it, except for these 2.
 
  1. No HTML emails

 I don't like HTML emails because usual textual matter doesn't need
 it. It simply bloats things and if the renderer your client is using
 doesn't have some feature that the sender uses, it'll appear broken.


 I agree. We don't need HTML emails.

  2. No attachments.

 This makes sense for a list because, as I understand it, the list server
 has to send a copy of the attachment to everyone on the list. It's an
 avoidable expense. A lot simpler to send a link to something on dropbox
 or somewhere.


 Not only that, it is a pain to download something and open it in some
 application just to know what is inside. It is a lot better to send a link
 instead of sending attachments.


​Anand, how do you consume your emails? I get my emails on my phones as
well, in gmail, which has a preview feature in both desktop and on mobile.​


 Anand

___
BangPypers mailing list
BangPypers@python.org
https://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] Raising issue WRT Bangpypers mailing list

2014-05-22 Thread Jeffrey Jose
​At the risk of giving a non-issue more visibility, we’re being extremely
silly here. I went through the emails here and I dont find anything
offensive or sarcastic or twisted in any of the replies. I do however find
2 things odd though.

   - Senthil’s original reply of *I looked and found it* was kinda
   pointless. It was not required, and totally not helpful; Then again you
   tend to ignore noise from signal pretty fast if you’re on internet often.
   - There’s no reason why we’re moderating messages this aggressively.
   Voices of dissent, however bad it might be, need not be curtailed.



On Thu, May 22, 2014 at 3:17 PM, Noufal Ibrahim KV
nou...@nibrahim.net.inwrote:


 Just for context, here's the email where Danny says that he was not
 offended by the first email and didn't interpret it in the way that
 Pratham did
 https://mail.python.org/pipermail/bangpypers/2014-May/010161.html

 and my follow up reply saying that I didn't mean it that way either.
 https://mail.python.org/pipermail/bangpypers/2014-May/010163.html

 Also, I'm not managing or policing the list so please don't CC me
 directly in any replies. The list owner is mentioned on the listinfo
 page is probably the right person to contact for this kind of thing.


 On Thu, May 22 2014, Pratham Gadre wrote:

  Hello Brian  Jesse,
  I am an incognito member of the BangPypers mailing list. Reason for being
  incognito is
  simple, the people who run the list are very sensitive to criticism and
  react in a harsh and non-professional manner.
 
  I was looking to see, who I could raise this issue to, via the Python.org
  website, I saw Brian was the communications officer and Jesse is the
  Vice-Chairman of the PSF.
 
  This time, I write to you with links to the content of the emails, which
  can be found at
  https://mail.python.org/pipermail/bangpypers/2014-May/010156.html
 
  My replies are available here - http://pastebin.com/7kWWcMvF
 
  Both my emails were rejected with the response:
  Your message was deemed inappropriate by the moderator.
 
  Screenshot of replied from the moderator.
 
 http://www.anonimg.com/uploaded-510571c65c8efdb3970761d95f85f5a8.png.html
 
  At the risk of sounding like a 5 year old complaining about a bully
 hitting
  him in school, may I request you to kindly warn the moderators of the
  mailing list.
 
  I guess as member of the community, if I feel something is not right, I
  have the right to voice my opinion. A few months back Anand Pillai, a PSF
  member.
  https://mail.python.org/pipermail/bangpypers/2013-September/thread.html
 
  It would really help, if there is some intervention.
 
  I would have ideally written to the list owners, but I have real bad
  experience in dealing with them earlier.
 
  Regards
  Pratham

 --
 Cordially,
 Noufal
 http://nibrahim.net.in
 ___
 BangPypers mailing list
 BangPypers@python.org
 https://mail.python.org/mailman/listinfo/bangpypers

___
BangPypers mailing list
BangPypers@python.org
https://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] Raising issue WRT Bangpypers mailing list

2014-05-22 Thread Jeffrey Jose
Ha, I stand corrected. Senthil's reponse did contain everything the
original poster wanted. Now I'm not sure what everyone's upset about.



On Thu, May 22, 2014 at 3:45 PM, Jeffrey Jose jeffjosej...@gmail.comwrote:

 ​At the risk of giving a non-issue more visibility, we’re being extremely
 silly here. I went through the emails here and I dont find anything
 offensive or sarcastic or twisted in any of the replies. I do however find
 2 things odd though.

- Senthil’s original reply of *I looked and found it* was kinda
pointless. It was not required, and totally not helpful; Then again you
tend to ignore noise from signal pretty fast if you’re on internet often.
- There’s no reason why we’re moderating messages this aggressively.
Voices of dissent, however bad it might be, need not be curtailed.



 On Thu, May 22, 2014 at 3:17 PM, Noufal Ibrahim KV nou...@nibrahim.net.in
  wrote:


 Just for context, here's the email where Danny says that he was not
 offended by the first email and didn't interpret it in the way that
 Pratham did
 https://mail.python.org/pipermail/bangpypers/2014-May/010161.html

 and my follow up reply saying that I didn't mean it that way either.
 https://mail.python.org/pipermail/bangpypers/2014-May/010163.html

 Also, I'm not managing or policing the list so please don't CC me
 directly in any replies. The list owner is mentioned on the listinfo
 page is probably the right person to contact for this kind of thing.


 On Thu, May 22 2014, Pratham Gadre wrote:

  Hello Brian  Jesse,
  I am an incognito member of the BangPypers mailing list. Reason for
 being
  incognito is
  simple, the people who run the list are very sensitive to criticism and
  react in a harsh and non-professional manner.
 
  I was looking to see, who I could raise this issue to, via the
 Python.org
  website, I saw Brian was the communications officer and Jesse is the
  Vice-Chairman of the PSF.
 
  This time, I write to you with links to the content of the emails, which
  can be found at
  https://mail.python.org/pipermail/bangpypers/2014-May/010156.html
 
  My replies are available here - http://pastebin.com/7kWWcMvF
 
  Both my emails were rejected with the response:
  Your message was deemed inappropriate by the moderator.
 
  Screenshot of replied from the moderator.
 
 http://www.anonimg.com/uploaded-510571c65c8efdb3970761d95f85f5a8.png.html
 
  At the risk of sounding like a 5 year old complaining about a bully
 hitting
  him in school, may I request you to kindly warn the moderators of the
  mailing list.
 
  I guess as member of the community, if I feel something is not right, I
  have the right to voice my opinion. A few months back Anand Pillai, a
 PSF
  member.
  https://mail.python.org/pipermail/bangpypers/2013-September/thread.html
 
  It would really help, if there is some intervention.
 
  I would have ideally written to the list owners, but I have real bad
  experience in dealing with them earlier.
 
  Regards
  Pratham

 --
 Cordially,
 Noufal
 http://nibrahim.net.in
 ___
 BangPypers mailing list
 BangPypers@python.org
 https://mail.python.org/mailman/listinfo/bangpypers



___
BangPypers mailing list
BangPypers@python.org
https://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] Tornado or twisted?

2014-05-05 Thread Jeffrey Jose
I've played around with Twisted enough to not recommend it to someone
unless they know what they are doing. The learning curve is pretty steep,
and it's hard to wrap your head around the callback paradigm. It's super
powerful once you get past growing pains, which as I mentioned is super
significant.

Tornado on the other hand is very minimalist and reminds you of webpy if
you've worked with it.

I've not worked with django so I can't comment on how django hooks into
each of these.
On May 5, 2014 5:34 PM, Vaidik Kapoor kapoor.vai...@gmail.com wrote:

 Ah! Good find! The same guy has written an implementation for Socket.IO as
 well: https://github.com/mrjoes/tornadio

 Vaidik Kapoor
 vaidikkapoor.info


 On 5 May 2014 16:34, Mukesh Yadav mak@gmail.com wrote:

  Thanks guys,
 Seems I have to give a thought over gevent too. Meanwhile
  https://github.com/mrjoes/sockjs-tornado also seems good option though
 in
  this case sockjs is being used.
  Sockjs is as good as socket.io.
 
 
  On Mon, May 5, 2014 at 3:25 PM, Vaidik Kapoor kapoor.vai...@gmail.com
  wrote:
 
   Gevent is also a good option. You should read this article:
  
  
 
 http://engineering.pinterest.com/post/65713073803/how-we-use-gevent-to-go-fast
   .
  
   This project should be helpful for whatever you are trying to do:
   https://github.com/abourget/gevent-socketio
  
   Vaidik Kapoor
   vaidikkapoor.info
  
  
   On 5 May 2014 12:50, Gora Mohanty g...@mimirtech.com wrote:
  
Hi,
   
Why not consider gevent? Do not have enough real-life experience with
  it
   to
comment on your capacity requirements, but those will also be a
  function
   of
your application, and will need to be actually measured.
   
Regards,
Gora
On May 5, 2014 11:48 AM, Mukesh Yadav mak@gmail.com wrote:
   
 Hey guys,
I'm starting a new projects which requires real time update,
   something
 like tweetdeck. After initial research I have finalized twisted and
 tornado. But i'm confused which one to use.

 Requirement:
 1. Should work flawlessly with Django.
 2. Should be fast enough to handle around 10K concurrent users, on
   small
 instance (Server).
 3. Should work on socket.io as I'm planning it use it.


 NOTE: I'm just a Newbie :P

 --
 Regards
 Mukesh Yadav
 mukeshyadav.com
 ___
 BangPypers mailing list
 BangPypers@python.org
 https://mail.python.org/mailman/listinfo/bangpypers

___
BangPypers mailing list
BangPypers@python.org
https://mail.python.org/mailman/listinfo/bangpypers
   
   ___
   BangPypers mailing list
   BangPypers@python.org
   https://mail.python.org/mailman/listinfo/bangpypers
  
 
 
 
  --
  Regards
  Mukesh Yadav
  mukeshyadav.com
  ___
  BangPypers mailing list
  BangPypers@python.org
  https://mail.python.org/mailman/listinfo/bangpypers
 
 ___
 BangPypers mailing list
 BangPypers@python.org
 https://mail.python.org/mailman/listinfo/bangpypers

___
BangPypers mailing list
BangPypers@python.org
https://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] Mail formatting for this list

2013-09-14 Thread Jeffrey Jose
On Sat, Sep 14, 2013 at 4:55 PM, Noufal Ibrahim nou...@nibrahim.net.inwrote:

 Balachandran Sivakumar benignb...@gmail.com writes:

 [...]

  It is not a strong preference. It is something that a
  lot of us are used to, and so I assume people are fine with it and
  hence status quo :).

 It's quite a strong preference for me. I'm also very pedantic about the
 way I format my emails.

 I'm not too particular about horizontal space. I think the current trend
 which favours widescreen aspect ratios is deplorable and not very
 helpful while coding. It's irritating when a line of text is so long on
 a monitor that I have to deliberately look left to right.


Conveniently changed the topic from mails to code eh? :)

Anyway, I'm with you on that.  Especially hard when I have to diff
something side by side.
Irritating? Yes. Deplorable? Not quite.



 I much prefer
 vertical screen space so that I don't have to repeatedly scroll and jump
 around while trying to read some code.


I dont understand. What's your viewport width? Can that only support 80ish
chars? Are you on mobile/tablet?

I'm on gmail, and I can see .. chatbox, this email, lots of whitespace AND
advertisements.. from left to right.




 But, if people find this format difficult and prefer a
  full-width format, we can try out and ask for people's feedback. Just
  that it takes a few days to get used it and that should be fine.

 Please no. It's annoying and there's no real gain from allowing long
 lines of text.


What's annoying to me is that this breaks my flow of reading when I have
to constantly move my eyes right to left, hoping I land on the next line.
Its especially hard to find the correct line when you're in the middle of a
big paragraph.


I think what I'm trying to say is for code, 80 chars (for the most part)
and for emails, lets use the full width (and let the editor/browser/client
deal with wrapping)


-jeff


 [...]

 --
 Cordially,
 Noufal
 http://nibrahim.net.in
 ___
 BangPypers mailing list
 BangPypers@python.org
 https://mail.python.org/mailman/listinfo/bangpypers

___
BangPypers mailing list
BangPypers@python.org
https://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] Mail formatting for this list

2013-09-13 Thread Jeffrey Jose
Except that when it breaks sentences at places
completely random like this with a hanging
word


Do people have strong preference with 80chars? What would it take to try
out full-width for sometime?


On Fri, Sep 13, 2013 at 4:59 PM, Balachandran Sivakumar 
benignb...@gmail.com wrote:

 Hi,

 On Fri, Sep 13, 2013 at 4:04 PM, Saager Mhatre saager.mha...@gmail.com
 wrote:
  Mods/Admins,
  Is there a specific reason we've set this list to wrap all mail messages
 at
  80 characters?
  Just that it seems a little unnecessary to me, give all the hi-resolution
  wide-screen displays in general use.
 

   Still, it is easier to view if it fully fits into your
 vision :) I would prefer it being 80. Thanks



 --
 Thank you
 Balachandran Sivakumar

 Arise Awake and stop not till the goal is reached.
  - Swami
 Vivekananda

 Mail: benignb...@gmail.com
 Blog: http://benignbala.wordpress.com/
 ___
 BangPypers mailing list
 BangPypers@python.org
 https://mail.python.org/mailman/listinfo/bangpypers

___
BangPypers mailing list
BangPypers@python.org
https://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] Python Wats

2013-09-11 Thread Jeffrey Jose
On Wed, Sep 11, 2013 at 9:02 PM, Vardhan Varma vardhanva...@gmail.comwrote:

 On Wed, Sep 11, 2013 at 8:42 PM, Pranjal Mittal 
 pranjal.mittal.ec...@iitbhu.ac.in wrote:

  Here you go-
 
  import socket
  socket.gethostbyaddr(socket.gethostname())[2]
 
 
  On Wed, Sep 11, 2013 at 8:16 PM, ashish makani ashish.mak...@gmail.com
  wrote:
 
   Found this quick, nifty way to determine the ip address of the machine
  your
   py script is running on
  
   import commands
   commands.getoutput(/sbin/ifconfig).split(\n)[1].split()[1][5:]
 
 
 Several machines have multiple IP addresses, and 0x7f01 is least
 interesting one..
 On most modern linux distros, 'hostname -I' also works.

  commands.getoutput('hostname -I').split()
 ['192.168.1.120', '11.22.103.1']


Hows this different better than socket.gethostbyaddr?
I dont have a machine with multiple IPs, doesnt this work there?

I come from a place where you use *batteries* as much as possible, and
where shelling out is the last resort.

 ___
 BangPypers mailing list
 BangPypers@python.org
 https://mail.python.org/mailman/listinfo/bangpypers

___
BangPypers mailing list
BangPypers@python.org
https://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] Python Wats

2013-09-10 Thread Jeffrey Jose
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
cfile:   target filename; defaults to source with 'c' or 'o' appended
 ('c' normally, 'o' in optimizing mode, giving .pyc or .pyo)
dfile:   purported filename; defaults to source (this is the filename
 that will show up in error messages)
doraise: flag indicating whether or not an exception should be
 raised when a compile error is found. If an exception
 occurs and this flag is set to False, a string
 indicating the nature of the exception will be printed,
 and the function will return to the caller. If an
 exception occurs and this flag is set to True, a
 PyCompileError exception will be raised.

Note that it isn't necessary to byte-compile Python modules for
execution efficiency -- Python itself byte-compiles a module when
it is loaded, and if it can, writes out the bytecode to the
corresponding .pyc (or .pyo) file.

However, if a Python installation is shared between users, it is a
good idea to byte-compile all modules upon installation, since
other users may not be able to write in the source directories,
and thus they won't be able to write the .pyc/.pyo file, and then
they would be byte-compiling every module each time it is loaded.
This can slow down program start-up considerably.

See compileall.py for a script/module that uses this module to
byte-compile all installed files (or all files in selected
___
BangPypers mailing list
BangPypers@python.org
https://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] Female developer fired after tweeting about men's comments at PyCon 2013 and San Jose.

2013-03-23 Thread Jeffrey Jose
I disagree.

I haven't read the article but it looks like it talks about very specific
behavior in the python community which we are all part of.

-jeff
On Mar 23, 2013 3:01 PM, Gora Mohanty g...@mimirtech.com wrote:

 On 23 March 2013 14:49, Nitin Kumar nitin.n...@gmail.com wrote:
  Thought to share news eveen though it has very less to do with python.
 This
  happened at PyCon 2013.
 
  San Jose: A female developer was fired after tweeting about a group of
 men
  she said were making sexual comments at a computer programming co...
 
 
 http://ibnlive.in.com/news/female-developer-fired-after-tweeting-about-mens-sexual-comments/380690-11.html


 Please at least label such posts off-topic, or better yet
 refrain from posting them here. Just because it happened
 at Pycon does not make it relevant for the list.

 Regards,
 Gora
 ___
 BangPypers mailing list
 BangPypers@python.org
 http://mail.python.org/mailman/listinfo/bangpypers

___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] Female developer fired after tweeting about men's comments at PyCon 2013 and San Jose.

2013-03-23 Thread Jeffrey Jose
On Sat, Mar 23, 2013 at 3:50 PM, Dhruv Baldawa dhruvbald...@gmail.comwrote:

 The headlines are biased and misleading, the event is has been resolved,
 changes have been made to Code of Conduct. FYI, even one of the male
 developers was fired. I would suggest you read the following answer.


 http://www.quora.com/PyCon-Tweet-Controversy-March-2013/Was-it-appropriate-for-SendGrid-to-fire-Adria-Richards-over-the-PyCon-Tweet-Controversy/answer/Gayle-Laakmann-McDowell?srid=hd5Wshare=1


That was a good read. Thanks for sending that across.




 On Mar 23, 2013 3:30 PM, Nitin Kumar nitin.n...@gmail.com wrote:
 
  My apology Mr Gora,
 
  I didnt knew my mail will be taken this way. As it was related to PyCon
 but
  more of gender bias and how companies reacts.
 
  Didnt knew of other forum to share this news ;)
  Will surely take from next time.
 
  One more thing, if I dont like anything I just refrain rather that topic
  than making issue.
 
  Nitin K
  On Mar 23, 2013 3:14 PM, Gora Mohanty g...@mimirtech.com wrote:
 
   On 23 March 2013 15:08, Jeffrey Jose jeffjosej...@gmail.com wrote:
I disagree.
   
I haven't read the article but it looks like it talks about very
 specific
behavior in the python community which we are all part of.

 No, I dont think so.

   Maybe you would care to explain how this fits with the list's stated
   purpose of This group is for discussions related to the Python
   programming language. We welcome all kinds of discussions related to
   Python.?
  
   IMHO, this is a technically-oriented list, not a socially-oriented one.
   Plenty of other forums are available for discussing the kinds of things
   Nitin and you seem to want to.
  
   Regards,
   Gora
   ___
   BangPypers mailing list
   BangPypers@python.org
   http://mail.python.org/mailman/listinfo/bangpypers
  
  ___
  BangPypers mailing list
  BangPypers@python.org
  http://mail.python.org/mailman/listinfo/bangpypers
 ___
 BangPypers mailing list
 BangPypers@python.org
 http://mail.python.org/mailman/listinfo/bangpypers

___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] List compression imrpovement

2013-01-09 Thread Jeffrey Jose
On Wed, Jan 9, 2013 at 1:43 PM, Anand Chitipothu anandol...@gmail.comwrote:

 [[x for x in a if x%i == 0] for i in [2, 3]]


oh thats smart.
___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] 'dict' object has no attribute 'company_name'

2011-08-15 Thread Jeffrey Jose
On Aug 15, 2011 3:02 PM, Asif Jamadar asif.jama...@rezayat.net wrote:

 charges = [(c.company_name)

 for c in
ReportModel.objects.values('company_name').distinct()]


 but it throws this error:  'dict' object has no attribute 'company_name'



 any suggestions?


dict attribute access in python goes like this..

c['company_name ']

/jeff
- from a handheld device.
___
 BangPypers mailing list
 BangPypers@python.org
 http://mail.python.org/mailman/listinfo/bangpypers
___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] BangPypers meeting February 2011

2011-02-12 Thread Jeffrey Jose
Its kinda true that noSQL started as 'death to everything that's SQL'. As
things got matured people realized noSQL is not a replacement but another
tool in developers toolbox to solve problems.

And that's the reason some people dont ever use the term 'noSQL' because it
sounds like 'No SQL' and if they must they say 'noSQL' stands for 'not only
SQL' and not what it sounds.

/jeff

On Sat, Feb 12, 2011 at 11:06 PM, Noufal Ibrahim nou...@gmail.com wrote:

 On Sat, Feb 12 2011, Santosh Rajan wrote:

  My 2 cents before you jump into the nosql bandwagon.
 
  1) If sql works for you, stick with it. RDBMS's like postgeSQL, MySQL
  will not wake you up in the middle of the night with a crash.
  2) If you have scaling problems, add some horse power to you hardware,
  battery backed RAID, and solid state hard drives are good for you.
  (Prices have come down in the last year or two).
  3) Disk space is cheap. Avoid joins while using sql as far as
  possible. Create additional table to do your indexing and grouping.
  4) And if you still think you need nosql, god help you.

 [...]

 One of the things mentioned during the event was collecting logs from
 remote sites that have only access to the net for a short while every
 day. A data store like couch which works by appending documents is ideal
 for collecting log output. You keep dumping logs into it (over a local
 connection) and when you have access to the internet, you replicate all
 the local databases to a master couch database. I liked the idea and
 think it's an interesting way to approach the problem of synchronising
 logs.

 NoSQL databases are interesting and while RDBMs have their own
 applications, a lot of possiblities open up with document stores. To
 view them *purely* as alternatives to relational databases is, in my
 opinion, missing the point.

 From your last point, I take it that you feel that one shouldn't even
 consider noSQL databases and somehow spend money and time squeezing
 performance out of relational databases. That reminds me of people who
 refuse to try out new languages and technologies and make engineering
 decisions and stick to, say, COBOL.


 --
 ___
 BangPypers mailing list
 BangPypers@python.org
 http://mail.python.org/mailman/listinfo/bangpypers

___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] What kind of applications can we develop with Python

2010-12-01 Thread Jeffrey Jose
IIRC, most of the backend of youtube is written in python (unladen swallow
?)

/jeff

On Wed, Dec 1, 2010 at 7:36 PM, Noufal Ibrahim nou...@gmail.com wrote:

 On Wed, Dec 01 2010, Baishampayan Ghose wrote:

  one that I know of is flickr. About the power of the language there are
  others on this list who can better articulate.
 
  Flickr is written in PHP.

 [...]

 And Cal Henderson's Djangocon keynote on Why I hate Django is real fun
 to watch

 http://www.youtube.com/watch?v=i6Fr65PFqfk

 --
 ~noufal
 http://nibrahim.net.in
 ___
 BangPypers mailing list
 BangPypers@python.org
 http://mail.python.org/mailman/listinfo/bangpypers

___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] Beginner help

2010-10-03 Thread Jeffrey Jose
On Sun, Oct 3, 2010 at 9:28 AM, Gopalakrishnan Subramani 
gopalakrishnan.subram...@gmail.com wrote:

 If you want to be too smart, Emacs is the best one for all your typing
 need.
 It works well on Windows/Macs/Linux/Unix operating system.
 pymacs enable you to detect the basic python related error in emacs.


%s/Emacs/Vim/g


/jeff





 On Sat, Oct 2, 2010 at 9:34 AM, Vishal vsapr...@gmail.com wrote:

  if you are on Windows, try out PyScripter. I am sure you'll like it.
 
  Thanks and best regards,
  Vishal Sapre
 
  On Sat, Oct 2, 2010 at 4:51 PM, Noufal Ibrahim nou...@gmail.com wrote:
 
   On Sat, Oct 02 2010, Dennis Varkey wrote:
  
I heard about python and found that it was very simple to code.
I would like to know any IDE's in which i can code python in windows
  
   [...]
  
   There should be something you're already comfortable with that has a
   plugin for Python. You should use that. Switching development
   environments completely for different languages doesn't seem very
   productive to me.
  
   --
   ___
   BangPypers mailing list
   BangPypers@python.org
   http://mail.python.org/mailman/listinfo/bangpypers
  
 
 
 
  --
  Thanks and best regards,
  Vishal Sapre
 
  ---
  So say...Day by day, in every way, I am getting better, better and
 better
  !!!
  A Strong and Positive attitude creates more miracles than anything else.
  Because...Life is 10% how you make it, and 90% how you take it
  Diamond is another piece of coal that did well under pressure”
  May we do good and not evil. May we find forgiveness for ourself and
  forgive others. May we share freely, never taking more than we give.
  ___
  BangPypers mailing list
  BangPypers@python.org
  http://mail.python.org/mailman/listinfo/bangpypers
 
 ___
 BangPypers mailing list
 BangPypers@python.org
 http://mail.python.org/mailman/listinfo/bangpypers

___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] Dictionary : An elementary question

2010-08-19 Thread Jeffrey Jose
On Thu, Aug 19, 2010 at 10:31 AM, Sahasranaman MS sah...@naman.ms wrote:

  On Thursday 19 August 2010 07:08 AM, Kenneth Gonsalves wrote:

 On Wed, 2010-08-18 at 10:28 -0700, Anand Shankar wrote:

 I have no clues. Any inputs??

 sort order of dictionary keys is not guaranteed. Only a list will return
 items in the same order as entered.

 Python has an OrderedDict class from Python 3.1
 http://docs.python.org/dev/whatsnew/3.1.html#pep-372-ordered-dictionaries
 For older versions of python,  there are several other implementations that
 you could use.



When I was writing my reply I was thinking  - wasnt there something added
recently which is a dictionary and was ordered. Unfortunately I'm stuck on
2.5, so havent used this one.
Thanks for this.

 ___
 BangPypers mailing list
 BangPypers@python.org
 http://mail.python.org/mailman/listinfo/bangpypers

___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] Dictionary : An elementary question

2010-08-19 Thread Jeffrey Jose
On Thu, Aug 19, 2010 at 10:26 AM, Dipo Elegbede delegb...@dudupay.comwrote:

 Hi All,
 There really shouldn't be so much debate on the question asked.
 Someone actually gave a direct and clear answer. I'm new at python and
 his explanations were quite understandable.


I'm sorry that you sensed a debate in what happened to the question.
Personally I find it very refreshing when people contribute with different
ideas.
In this particular case, Shaswat Anand's reply of what OrdererdDicts are
(BSTs) was actually a new information to me. Had we closed the question the
moment we sense a right answer, I wouldnt have known that.


 If you call the d.keys() consecutively, you might get two different orders.


I dont think  it works the way you say it. d.keys() *should* return the same
way no matter how many times you call it. If the dictionary (d) changes in
between - because of the way HashTables/HashMaps are implemented - you are
bound to get in a different order.

*Long story short. *d.keys() will return the same thing if d doesnt change.


/jeff
___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] Dictionary : An elementary question

2010-08-18 Thread Jeffrey Jose
Excellent responses so far.

Dictionaries are optimized for retrieving key/value pairs. And to achieve
that, it compromises on the order in which stuff is stored.

This and more is very nicely presented in the Pycon 2010 talk - The Mighty
Dictionary. Highly recommended.

http://us.pycon.org/2010/conference/schedule/event/12/

http://us.pycon.org/2010/conference/schedule/event/12//jeff

On Wed, Aug 18, 2010 at 11:04 PM, Vinay Shastry vinayshas...@gmail.comwrote:

 On 18 August 2010 22:58, Anand Shankar anand_shan...@yahoo.com wrote:
  During a tutorial python session with my colleagues I was presented with
 a basic
  question
 
  d = {'apple':2,'banana':5, 'coke': 6}
  print d.keys()
  ['coke', 'apple', 'banana']
 
 
  Question is why does it not return
 
  ['apple','banana','coke']
 snip
  I have no clues. Any inputs??
 

 For this reason:
 It is best to think of a dictionary as an unordered set of key: value
 pairs

 http://docs.python.org/tutorial/datastructures.html#dictionaries

  d = {'apple':2,'banana':5, 'coke': 6}
  d
 {'coke': 6, 'apple': 2, 'banana': 5}
  print d.keys()
 ['coke', 'apple', 'banana']

 --
 Vinay S Shastry
 http://thenub.one09.net
 ___
 BangPypers mailing list
 BangPypers@python.org
 http://mail.python.org/mailman/listinfo/bangpypers

___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] source

2010-08-16 Thread Jeffrey Jose


 I don't think it'd help. It's a shell builtin without a man page of it's
 own. You'd either have to do man bash or help source

 wont `man builtin` take you to `man bash` (man tcsh, in my case)
automatically?


 --
 ___
 BangPypers mailing list
 BangPypers@python.org
 http://mail.python.org/mailman/listinfo/bangpypers

___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers


[BangPypers] EuroPython videos out now!

2010-08-15 Thread Jeffrey Jose
via:
http://www.europython.eu/blog/announcements/talk-videos-from-ep2010-published/

and videos are here.
http://europythonvideos.blip.tv/


enjoy!
/jeff
___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] how to delete base class attribute

2010-07-31 Thread Jeffrey Jose
On Thu, Jul 29, 2010 at 6:34 PM, Anand Balachandran Pillai 
abpil...@gmail.com wrote:

 On Thu, Jul 29, 2010 at 5:33 PM, Mahadevan R mdevan.foo...@gmail.com
 wrote:

  On Thu, Jul 29, 2010 at 4:24 PM, Nitin Kumar nitin.n...@gmail.com
 wrote:
   fine, but isn't there any way to hide few function of base class into
   derived one???
 
  You can try obscuring it:
 
  class y(x):
def __init__(self):
x.__init__(self)
 self.A = None
 

 Trying to do something like this in Python shows a mistake
 in the design of your classes. There are different ways to
 do this in Python. Here are a few.

 1. Prefix the function with double underscore ('__')
  as steve said in his email.


I echo the same sentiments as Anand and Steve. If your class inherits from
something, its assumed the child class is of the same `kind` as the parent.

What you're asking sounds like this,

I have a `Vehicle` class which can `drive()`, now I wanna subclass `Car`,
but my `Car` doesnt implement `drive()` method.


Having said that, I'll add another method to restrict access to this
odd-function using __getattribute__.

What is __getattribute__ ?
  Whenever you do access an attribute, be it for a function or an attribute
(like obj.foo() or obj.value), obj.__getattribute__ is called. Things are
really a little more involved than the simple explanation I wrote, but for
this case you just need to know that much.


class Parent(object):
def childShouldntCallMe(self):
   doParentStuff()


class Child(Parent):

def __getattribute__(self, name):
 if name == childShouldntCallMe:
 raise RestrictedAccessError # This could be a more polite
NotImplementedError
 else:
 return super(Child, self).__getattribute__(name)


/jeff
___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] how to delete base class attribute

2010-07-31 Thread Jeffrey Jose
On Thu, Jul 29, 2010 at 3:13 PM, Mehndi, Sibtey
sibtey.meh...@genpact.comwrote:

 Nitin,
 del can only remove the elements present in the instance
 dictionary. If you check self.__dict__ then it shows that A is not in the
 dictionary only 'a' and 'b' exist in the dict that's why it is giving the
 attribute error.


 Sibtey


To add to what Sibtey already finely explained,

The only valid use case of del/ __del__ happens to be cleaning up the
namespace if you're writing a module. Every other use case of del/__del__
might or might not work.

/jeff



 -Original Message-
 From: bangpypers-bounces+sibtey.mehndi=genpact@python.org [mailto:
 bangpypers-bounces+sibtey.mehndi bangpypers-bounces%2Bsibtey.mehndi=
 genpact@python.org] On Behalf Of Nitin Kumar
 Sent: Thursday, July 29, 2010 2:18 PM
 To: Bangalore Python Users Group - India
 Subject: [BangPypers] how to delete base class attribute

 Hi all,



 Say I have 10 functions in base class and I have inherited it in some
 derived class.

 But I only want 9 of the base class function to be available in child
 class.
 (and I don't want to make that one class private)



 class x:

def __init__(self):

self.a =3

self.b= 4

def A(self):

print (self.a)

def B(self):

print (self.b)



 class y(x):

def __init__(self):

x.__init__(self)

del (self.A)  #This is givingdel
 (self.A)

 AttributeError: A





 Anticipating your reply soon.

 --
 Nitin K
 ___
 BangPypers mailing list
 BangPypers@python.org
 http://mail.python.org/mailman/listinfo/bangpypers
 This e-mail (and any attachments), is confidential and may be privileged.
 It may be read, copied and used only
 by intended recipients. Unauthorized access to this e-mail (or attachments)
 and disclosure or copying of its
 contents or any action taken in reliance on it is unlawful. Unintended
 recipients must notify the sender immediately
 by e-mail/phone  delete it from their system without making any copies or
 disclosing it to a third person.

 ___
 BangPypers mailing list
 BangPypers@python.org
 http://mail.python.org/mailman/listinfo/bangpypers

___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] how to delete base class attribute

2010-07-31 Thread Jeffrey Jose
On Sun, Aug 1, 2010 at 12:11 AM, Nitin Kumar nitin.n...@gmail.com wrote:

 Thanks Jeffrey,

 I have one more query, but i am not able to explain you.
 will send u a mail in few min.

 Thanks


I recommend sending mails to the whole group if your mail is a followup to
the original problem. The purpose is 2 fold,

1. You'll get more eyeballs - more quality responses.
2. We can document it more formally so that someone later on can browse mail
archives.

/jeff




 On Sat, Jul 31, 2010 at 11:57 PM, Jeffrey Jose jeffjosej...@gmail.com
 wrote:

  On Thu, Jul 29, 2010 at 3:13 PM, Mehndi, Sibtey
  sibtey.meh...@genpact.comwrote:
 
   Nitin,
   del can only remove the elements present in the instance
   dictionary. If you check self.__dict__ then it shows that A is not in
 the
   dictionary only 'a' and 'b' exist in the dict that's why it is giving
 the
   attribute error.
  
  
   Sibtey
  
 
  To add to what Sibtey already finely explained,
 
  The only valid use case of del/ __del__ happens to be cleaning up the
  namespace if you're writing a module. Every other use case of del/__del__
  might or might not work.
 
  /jeff
 
 
  
   -Original Message-
   From: bangpypers-bounces+sibtey.mehndi=genpact@python.org [mailto:
   bangpypers-bounces+sibtey.mehndi bangpypers-bounces%2Bsibtey.mehndi=
   genpact@python.org] On Behalf Of Nitin Kumar
   Sent: Thursday, July 29, 2010 2:18 PM
   To: Bangalore Python Users Group - India
   Subject: [BangPypers] how to delete base class attribute
  
   Hi all,
  
  
  
   Say I have 10 functions in base class and I have inherited it in some
   derived class.
  
   But I only want 9 of the base class function to be available in child
   class.
   (and I don't want to make that one class private)
  
  
  
   class x:
  
  def __init__(self):
  
  self.a =3
  
  self.b= 4
  
  def A(self):
  
  print (self.a)
  
  def B(self):
  
  print (self.b)
  
  
  
   class y(x):
  
  def __init__(self):
  
  x.__init__(self)
  
  del (self.A)  #This is giving
   del
   (self.A)
  
   AttributeError: A
  
  
  
  
  
   Anticipating your reply soon.
  
   --
   Nitin K
   ___
   BangPypers mailing list
   BangPypers@python.org
   http://mail.python.org/mailman/listinfo/bangpypers
   This e-mail (and any attachments), is confidential and may be
 privileged.
   It may be read, copied and used only
   by intended recipients. Unauthorized access to this e-mail (or
  attachments)
   and disclosure or copying of its
   contents or any action taken in reliance on it is unlawful. Unintended
   recipients must notify the sender immediately
   by e-mail/phone  delete it from their system without making any copies
  or
   disclosing it to a third person.
  
   ___
   BangPypers mailing list
   BangPypers@python.org
   http://mail.python.org/mailman/listinfo/bangpypers
  
  ___
  BangPypers mailing list
  BangPypers@python.org
  http://mail.python.org/mailman/listinfo/bangpypers
 



 --
 Nitin K
 ___
 BangPypers mailing list
 BangPypers@python.org
 http://mail.python.org/mailman/listinfo/bangpypers

___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] pycon hacksessions?

2010-07-31 Thread Jeffrey Jose
As a person whos new to the whole scene, when you say Hacksessions  what
is it exactly ?

And what happens in a Hacksession?

/jeff


On Thu, Jul 22, 2010 at 8:17 PM, Zubin Mithra zubin.mit...@gmail.comwrote:

 Hey everyone,

 I could'nt find any info on whether or not hack sessions are going to be
 conducted as part of Pycon. Did I miss something(in the case that we
 *are *having
 them) or is there a reason we could'nt have them?

 Cheers,
 zm
 ___
 BangPypers mailing list
 BangPypers@python.org
 http://mail.python.org/mailman/listinfo/bangpypers

___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] nested list help

2010-07-28 Thread Jeffrey Jose
On Wed, Jul 28, 2010 at 1:01 PM, Anand Balachandran Pillai 
abpil...@gmail.com wrote:

 On Tue, Jul 27, 2010 at 7:03 PM, Vikram K kpguy1...@gmail.com wrote:

  Suppose i have this nested list:
 
   x
  [['NM100', 3, 4, 5, 6, 7], ['NM100', 10, 11, 12, 13], ['NM200', 15, 16,
  17]]
   for i in x:
  ...   print i
  ...
  ['NM100', 3, 4, 5, 6, 7]
  ['NM100', 10, 11, 12, 13]
  ['NM200', 15, 16, 17]
  
 
  how do i obtain from the above the following nested list:
 
   z
  [['NM100', 3, 4, 5, 6, 7, 10, 11, 12, 13], ['NM200', 15, 16, 17]]
   for i in z:
  ...   print i
  ...
  ['NM100', 3, 4, 5, 6, 7, 10, 11, 12, 13]
  ['NM200', 15, 16, 17]
  
 

 Isn't this the same question you asked in another thread ? Just that
 the list has more members now.


yeah you're right. The same question was posted elsewhere. I hope the author
responds to the very many replies he got.


  ___
  BangPypers mailing list
  BangPypers@python.org
  http://mail.python.org/mailman/listinfo/bangpypers
 



 --
 --Anand
 ___
 BangPypers mailing list
 BangPypers@python.org
 http://mail.python.org/mailman/listinfo/bangpypers

___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] nested list question

2010-07-14 Thread Jeffrey Jose
 List comprehensions are preferred to map and filter functions.In fact,
 filter is a syntactic sugar to list comprehension.



You're right in saying list comprehensions are preferred to map and filter -
not just from a readability standpoint but also from a performance
standpoint. (we all hate that .0001 of sec right? - no seriously)

However filter is *not* a syntactic sugar of list comprehension.

 l = [1,2,3,4,5,6,7,8]
 def foo(a):
... return [x for x in a if x % 2]
...
 def bar(a):
... return filter(lambda x: x%2, a)
...
 foo(l)
[1, 3, 5, 7]
 bar(l)
[1, 3, 5, 7]

 dis.dis(foo)
  2   0 BUILD_LIST   0
  3 DUP_TOP
  4 LOAD_ATTR0 (append)
  7 STORE_FAST   1 (_[1])
 10 LOAD_FAST0 (a)
 13 GET_ITER
   14 FOR_ITER31 (to 48)
 17 STORE_FAST   2 (x)
 20 LOAD_FAST2 (x)
 23 LOAD_CONST   1 (2)
 26 BINARY_MODULO
 27 JUMP_IF_FALSE   14 (to 44)
 30 POP_TOP
 31 LOAD_FAST1 (_[1])
 34 LOAD_FAST2 (x)
 37 CALL_FUNCTION1
 40 POP_TOP
 41 JUMP_ABSOLUTE   14
   44 POP_TOP
 45 JUMP_ABSOLUTE   14
   48 DELETE_FAST  1 (_[1])
 51 RETURN_VALUE
 52 LOAD_CONST   0 (None)
 55 RETURN_VALUE

 dis.dis(bar)
  2   0 LOAD_GLOBAL  0 (filter)
  3 LOAD_CONST   1 (code object lambda at
0x2a955e4d50, file stdin, line 2)
  6 MAKE_FUNCTION0
  9 LOAD_FAST0 (a)
 12 CALL_FUNCTION2
 15 RETURN_VALUE
 16 LOAD_CONST   0 (None)
 19 RETURN_VALUE


The alleged performance gain of list comprehension comes from the fact that
`filter` involve a function call (here= lambda). I'm sure this can be easily
proved using python -m timeit

Then what is syntatic sugar ?
This.

 def foo(a):
...a += 1
...return a
...
 def bar(a):
...a = a+1
...return a
...
 foo(10)
11
 bar(10)
11
 dis.dis(foo)
  2   0 LOAD_FAST0 (a)
  3 LOAD_CONST   1 (1)
  6 INPLACE_ADD
  7 STORE_FAST   0 (a)

  3  10 LOAD_FAST0 (a)
 13 RETURN_VALUE
 14 LOAD_CONST   0 (None)
 17 RETURN_VALUE
 dis.dis(bar)
  2   0 LOAD_FAST0 (a)
  3 LOAD_CONST   1 (1)
  6 BINARY_ADD
  7 STORE_FAST   0 (a)

  3  10 LOAD_FAST0 (a)
 13 RETURN_VALUE
 14 LOAD_CONST   0 (None)
 17 RETURN_VALUE



/jeff
___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] FW: [Python-Dev] [RELEASE] Python 2.7 released

2010-07-06 Thread Jeffrey Jose
Follow up reading.

Python 2.7 released (and what that means) -
http://sayspy.blogspot.com/2010/07/python-27-released-and-what-that-means.html

/jeff

On Tue, Jul 6, 2010 at 9:44 AM, Senthil Kumaran orsent...@gmail.com wrote:

 On Sun, Jul 04, 2010 at 10:34:57AM -0500, Benjamin Peterson wrote:
 
  On behalf of the Python development team, I'm jocund to announce the
 second
  release candidate of Python 2.7.
 
  Python 2.7 will be the last major version in the 2.x series. However, it
 will
  also have an extended period of bugfix maintenance.
 
  2.7 includes many features that were first released in Python 3.1. The
 faster io
  module, the new nested with statement syntax, improved float repr, set
 literals,
  dictionary views, and the memoryview object have been backported from
 3.1. Other
  features include an ordered dictionary implementation, unittests
 improvements, a
  new sysconfig module, auto-numbering of fields in the str/unicode format
 method,
  and support for ttk Tile in Tkinter.  For a more extensive list of
 changes in
  2.7, see http://doc.python.org/dev/whatsnew/2.7.html or Misc/NEWS in the
 Python
  distribution.
 
  To download Python 2.7 visit:
 
   http://www.python.org/download/releases/2.7/
 
  2.7 documentation can be found at:
 
   http://docs.python.org/2.7/
 
  This is a production release and should be suitable for all libraries and
  applications.  Please report any bugs you find, so they can be fixed in
 the next
  maintenance releases.  The bug tracker is at:
 
   http://bugs.python.org/
 
 
  Enjoy!
 
  --
  Benjamin Peterson
  Release Manager
  benjamin at python.org
  (on behalf of the entire python-dev team and 2.7's contributors)
  ___
  Python-Dev mailing list
  python-...@python.org
  http://mail.python.org/mailman/listinfo/python-dev
  Unsubscribe:
 http://mail.python.org/mailman/options/python-dev/orsenthil%40gmail.com

 --
 Senthil

 Algo só é impossível até que alguém duvida e acaba provando o
 contrário.
-- Albert Einstein

 ___
 BangPypers mailing list
 BangPypers@python.org
 http://mail.python.org/mailman/listinfo/bangpypers


___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] designing programs

2010-06-28 Thread Jeffrey Jose
[OFFTOPIC]

%s/corporate/enterprise/g

FTFY.

/jeff

On Sun, Jun 27, 2010 at 10:56 AM, Kenneth Gonsalves law...@au-kbc.orgwrote:

 On Saturday 26 June 2010 21:02:52 shameek ghosh wrote:
  Well...Although I have not done this much,  but I believe a modelling
 tool
  like UML helps when you show your design to somebody else and secondly
   there might be cases where UML like modelling tools may also be
 converted
   to some specific code.
 

 great for corporate java guys - write 1000 lines of UML, which generates
 5000
 lines of XML which generates 5 lines of java code which generates
 100,000
 lines of error messages - and charge $1 per line - and go laughing all the
 way
 to the bank.

 s/corporate/enterprise?
 --
 Regards
 Kenneth Gonsalves
 Senior Associate
 NRC-FOSS at AU-KBC
 ___
 BangPypers mailing list
 BangPypers@python.org
 http://mail.python.org/mailman/listinfo/bangpypers

___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] list to dictionary problem

2010-06-22 Thread Jeffrey Jose
2 methods spring to my mind, first one is what Nitin Kumar has already
mentioned. Looping over a list of tuples. Make sure you have a sorted list
first.

a.sort()
for key, value in a:
  if key == cat:
   break

# now value is 2

The second method is a little fancy, mentioning it here for the sake of
completeness.


# Note, I havent tested this code, but it should work.

import itertools

a.sort() # this is necessary, and anyway for a tuple sort() sorts it by
first element
groups = itertools.groupby(a, key = lambda x: x[0])

# now groups would look something like this
# [(cat, sub-iterator), (dog, sub-iterator)]

# now loop through groups, and when you hit cat, extract the first item
out of sub-iterator

for key, iterator in groups:
  if key == cat:
 break

firstValue = list(iterator)[0]
now iterator will yield values of cat, starting with 2, 5, 9, 6



On Tue, Jun 22, 2010 at 2:24 PM, Nitin Kumar nitin.n...@gmail.com wrote:

 for such things, always try to prefer tuple

 ex:

  cache= (('cat',2),('cat',5),('cat',9),('dog',6))
  for x,y in cache:
 print (x,y)

 cat 2
 cat 5
 cat 9
 dog 6

 On Tue, Jun 22, 2010 at 8:43 AM, Senthil Kumaran orsent...@gmail.com
 wrote:

  On Tue, Jun 22, 2010 at 02:23:43AM -, Vikram  wrote:
   Suppose i have this list:
  
a = [['cat',2],['cat',5],['cat',9],['dog',6]]
a
   [['cat', 2], ['cat', 5], ['cat', 9], ['dog', 6]]
  
   Now, there is a nice way to obtain the value 9.
 
  This is using the side effect of dict creation. Not a nice way. :)
  The rule is that last value with the same key will be over-written. If
  you use it any of your larger applications, the next person who is
  going to read your code will likely be frustrated.
 
z = dict(a)
z
   {'dog': 6, 'cat': 9}
  
   Is there any elegant way to extract the value 2? (Value corresponding
 to
  the first occurence of 'cat' in the 2-D list
 
  Nope, it is not elegant.
  The best way is to be explicit. Loop over list, create a dict with the
  value as the list of values the original list and then deal with the
  list value as you would like to. First element is elegantly [0] and
  the last element is nicely [-1]. :)
 
  --
  Senthil
 
  We don't understand the software, and sometimes we don't understand the
  hardware, but we can *___   see* the blinking lights!
  ___
  BangPypers mailing list
  BangPypers@python.org
  http://mail.python.org/mailman/listinfo/bangpypers
 



 --
 Nitin K
 ___
 BangPypers mailing list
 BangPypers@python.org
 http://mail.python.org/mailman/listinfo/bangpypers

___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] biopython

2010-06-14 Thread Jeffrey Jose
*I'm still waiting* to get that page open.

On Tue, Jun 15, 2010 at 10:28 AM, Senthil Kumaran orsent...@gmail.comwrote:

 On Tue, Jun 15, 2010 at 09:46:14AM +0530, Srinivas Reddy Thatiparthy wrote:
  point your browser to www://docs.python.org.
 

 Just a fun nit-pick. Seems to be a fun protocol to me. :)

 --
 Senthil

 É muito simples ser sábio. Basta pensar em uma coisa estúpida e não
 falá-la.
--Sam Levenson

 ___
 BangPypers mailing list
 BangPypers@python.org
 http://mail.python.org/mailman/listinfo/bangpypers


___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] Extracting zipfile

2010-05-31 Thread Jeffrey Jose
Correct me if I'm wrong but tab-completion doesn't work out of the box for
standard python interpreter.

On Mon, May 31, 2010 at 11:05 AM, Noufal Ibrahim nou...@gmail.com wrote:

 On Mon, May 31, 2010 at 8:32 AM, Jeffrey Jose jeffjosej...@gmail.com
 wrote:
  Dear Murugadoss,
 
  If you're starting out Python, I highly recommend IPython (
  http://ipython.scipy.org/moin/ ). With its excellent tab completion, you
  would never run into an  AttributeError

 -1. Tab completion is there in the standard interpreter and ipython is
 not a substitute for reading the documentation and going through the
 tutorial which evidently the OP has not done.

 --
 ~noufal
 http://nibrahim.net.in
 ___
 BangPypers mailing list
 BangPypers@python.org
 http://mail.python.org/mailman/listinfo/bangpypers

___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] UI Designing

2010-05-31 Thread Jeffrey Jose
For UI design, I

1. Start off with pen and paper, quickly mock up several designs and
interaction patterns
2. Proceed onto Photoshop/Illustrator to get a feel of how things would
look at the end.

Repeat 1 and 2 over and over

Once I'm ok with a design, I proceed to the next phase, probably writing
some code.

/jeff

On Mon, May 31, 2010 at 3:52 AM, Gaurav Kalra gvka...@gmail.com wrote:

 Hi.

 Can you please share what sort of UI Design tools the members on the
 list currently use for designing web applications ?


 --
 With Thanks
 Gaurav Kalra
 gvka...@googlemail.com
 ___
 BangPypers mailing list
 BangPypers@python.org
 http://mail.python.org/mailman/listinfo/bangpypers

___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] Harvestman error

2010-05-30 Thread Jeffrey Jose
Let me state at the outset that I have no idea what Harvestman is or what
you're trying to acheieve.

Looking at the stacktrace, I'll give you some pointers as to what I'd do if
I had got this error.


   1. File
   
/usr/lib/python2.6/site-packages/HarvestMan-2.0.4betadev_r253-py2.6.egg/harvestman/lib/rules.py,
   line 355, in apply_word_filter
   2. if self._configobj.wordfilterre.search(data):
   3. AttributeError: 'NoneType' object has no attribute 'search'


This tells me that self._configobj is None, which clearly it shouldnt be.
Your first step should be to identify where is self._configobj gets defined.

search for self._configobj =  or self._configobj= in the py files ( that
is if its something that gets defined automatically)

Since the error comes from one of the library files (
/usr/lib/python2.6/site-packages/HarvestMan-2.0.4betadev_r253-py2.6.egg/harvestman/lib/rules.py)

it shows something you've done wrongly. One of the things you should keep in
mind while using third party frameworks (Harvestman is some kinda framwork
right ? ) it needs to have all things in place to get it working. Read the
docs, search google for example programs/code snippets.

Another clue is configobj - config .. so this has something to do with
config. Probably a bad config file ?

I know this is too vague, as I said I have no idea what this Harvestman is.


Good Luck
/jeff


On Sun, May 30, 2010 at 9:56 PM, JAGANADH G jagana...@gmail.com wrote:

 Dear All I was trying to run Harvestman(A Python tool for web harvesting).
 I got the following error
 http://pastebin.com/uPzUs0Xw

 My configuration file is http://pastebin.com/dfhiy2Q6

 Can any body help me regarding this.

 I was trying to harvest my blog with a word filter 'Python'

 --
 **
 JAGANADH G
 http://jaganadhg.freeflux.net/blog
 ___
 BangPypers mailing list
 BangPypers@python.org
 http://mail.python.org/mailman/listinfo/bangpypers

___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] Harvestman error

2010-05-30 Thread Jeffrey Jose
that's great. I'm sure he'll have better input.

On Sun, May 30, 2010 at 10:27 PM, Ramdas S ram...@gmail.com wrote:

 On Sun, May 30, 2010 at 10:23 PM, Jeffrey Jose jeffjosej...@gmail.com
 wrote:

  Let me state at the outset that I have no idea what Harvestman is or what
 
 
 FYI Author of Harvestman Anand Pillai is on this list.

 --
 Ramdas S
 +91 9342 583 065
 ___
 BangPypers mailing list
 BangPypers@python.org
 http://mail.python.org/mailman/listinfo/bangpypers

___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] Extracting zipfile

2010-05-30 Thread Jeffrey Jose
Dear Murugadoss,

If you're starting out Python, I highly recommend IPython (
http://ipython.scipy.org/moin/ ). With its excellent tab completion, you
would never run into an  AttributeError


/jeff


On Mon, May 31, 2010 at 7:30 AM, Roshan Mathews rmath...@gmail.com wrote:

 On Mon, May 31, 2010 at 05:56, murugadoss murugadoss2...@gmail.com
 wrote:
  zipfile.extractall(home/murugadoss/testfile.zip)
  Traceback (most recent call last):
   File stdin, line 1, in module
  AttributeError: 'module' object has no attribute 'extractall'

 http://docs.python.org/library/zipfile.html#zipfile.ZipFile.extractall

 `extractall' is a method on ZipFile objects.

 You might need to do something like:
 z = zipfile.ZipFile(path_to_file)
 z.extractall(...)
 ___
 BangPypers mailing list
 BangPypers@python.org
 http://mail.python.org/mailman/listinfo/bangpypers

___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] if we compare Rails and django

2010-05-01 Thread Jeffrey Jose
Forgive if I sound rude, but whenever I see replies like lots of this and
lots of that I get a feeling that you dont really know what you're going to
do.

I admire the fact that you want to use the _best_ in the business but you
should be mature enough to understand that however good something seems, it
has its own weakness. The key is to use something which compliments what
you're looking for. And lots of ajax and javascript and also video
streaming is not what you're looking for..

Its like saying .. which is the best - Mac or PC . and oh I do a lot of
clicking, opening applications and browsing internet.

I'm guessing you already know Rails and Django are in 2 different languages
- which means if we choose something for you you'll have to learn that
language - unless you know both in which case you wouldn't have asked this
question in the first place.

*First rule of asking anything on internet - convey the idea that you've
done your homework. Nobody likes to talk to a rubber duck who just asks
random questions. If I find someone who's honestly tried before but is just
asking an opinion I'll be glad to help*

+1 for Perl CGI. After all Internet was built on Perl.

/jeff

On Sat, May 1, 2010 at 11:44 AM, BR!j!TH briji...@gmail.com wrote:

 If I want to create a web app with lots of ajax,java scripts and also video
 streaming etc


 On 1 May 2010 11:17, Diptanu Choudhury admin.nitj...@gmail.com wrote:

  What's your purpose and the domain that you are going to work on? Django
  and
  Rails have their strengths and weaknesses. So, it all depends what your
  purpose is.
 
  On Sat, May 1, 2010 at 10:34 AM, BR!j!TH briji...@gmail.com wrote:
 
   Hi,
  
   Which is the best web framework Rails or Django.
   ___
   BangPypers mailing list
   BangPypers@python.org
   http://mail.python.org/mailman/listinfo/bangpypers
  
 
 
 
  --
  Thanks,
  Diptanu Choudhury
  Just a Coder, ThoughtWorks India
  Mobile - 09886760964
  Web - www.linkedin.com/in/diptanu
  ___
  BangPypers mailing list
  BangPypers@python.org
  http://mail.python.org/mailman/listinfo/bangpypers
 
 ___
 BangPypers mailing list
 BangPypers@python.org
 http://mail.python.org/mailman/listinfo/bangpypers

___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] if we compare Rails and django

2010-05-01 Thread Jeffrey Jose
ah, DreamWeaver. Good old days.

On Sat, May 1, 2010 at 11:57 PM, Kenneth Gonsalves law...@au-kbc.orgwrote:

 On Saturday 01 May 2010 11:34:40 pm kausikram krishnasayee wrote:
   python cgi is better - and zope rocks
 
  zope3 rocks. correction.
 

 but the best framework that is miles ahead of all competition is Frontpage
 with access backend controlled by dreamweaver.
 --
 regards
 Kenneth Gonsalves
 Senior Associate
 NRC-FOSS
 http://certificate.nrcfoss.au-kbc.org.in
 ___
 BangPypers mailing list
 BangPypers@python.org
 http://mail.python.org/mailman/listinfo/bangpypers

___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] if we compare Rails and django

2010-05-01 Thread Jeffrey Jose
I second suggestion of jQuery. I've had fantastic results with jQuery so I
can totally recommend that. Also I remember reading about django and jQuery
integration a while back - althou' I never really tried that myself.

If you happen to choose django (and jQuery without any second thoughts for
client side work) I'm just saying (from what I've read online) they get
along pretty well.

Good luck.
/jeff

On Sun, May 2, 2010 at 1:59 AM, Dhananjay Nene dhananjay.n...@gmail.comwrote:

 To the best of my knowledge ajax, java scripts require you to carefully
 select a good client side library. I would suggest jquery. I have no clue
 about video streaming.

 There is little in your question to help decide the choice of the
 framework.
 However the frameworks are the carts. The languages you prefer are the
 horses. So I would suggest focus on deciding which language you are more
 comfortable with (put the horse before the cart). And if language doesn't
 matter - CGI or PHP might serve just as well :)

 On Sat, May 1, 2010 at 11:44 AM, BR!j!TH briji...@gmail.com wrote:

  If I want to create a web app with lots of ajax,java scripts and also
 video
  streaming etc
 
 
  On 1 May 2010 11:17, Diptanu Choudhury admin.nitj...@gmail.com wrote:
 
   What's your purpose and the domain that you are going to work on?
 Django
   and
   Rails have their strengths and weaknesses. So, it all depends what your
   purpose is.
  
   On Sat, May 1, 2010 at 10:34 AM, BR!j!TH briji...@gmail.com wrote:
  
Hi,
   
Which is the best web framework Rails or Django.
___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers
   
  
  
  
   --
   Thanks,
   Diptanu Choudhury
   Just a Coder, ThoughtWorks India
   Mobile - 09886760964
   Web - www.linkedin.com/in/diptanu
   ___
   BangPypers mailing list
   BangPypers@python.org
   http://mail.python.org/mailman/listinfo/bangpypers
  
  ___
  BangPypers mailing list
  BangPypers@python.org
  http://mail.python.org/mailman/listinfo/bangpypers
 



 --
 
 blog: http://blog.dhananjaynene.com
 twitter: http://twitter.com/dnene
 ___
 BangPypers mailing list
 BangPypers@python.org
 http://mail.python.org/mailman/listinfo/bangpypers

___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] recursion not working

2010-03-15 Thread Jeffrey Jose
Good catch.

On Mon, Mar 15, 2010 at 2:14 PM, Roshan Mathews rmath...@gmail.com wrote:

 On Mon, Mar 15, 2010 at 13:54, Kenneth Gonsalves law...@au-kbc.org
 wrote:
 for child in children:
 getaccbal(child.id,bal)

 This line returns a balance which is discarded.  Maybe it should be:
 bal += getaccbal(...) ?

 Roshan Mathews
 ___
 BangPypers mailing list
 BangPypers@python.org
 http://mail.python.org/mailman/listinfo/bangpypers

___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers


[BangPypers] DreamPie - A new Interactive Python Shell

2010-02-22 Thread Jeffrey Jose
I remember a while ago we were talking about python shells. I came across
this. http://dreampie.sourceforge.net/

Note: I havent given it a try. Just sharing it incase someone finds it
useful. Share with us your thoughts if you do.

From the website
DreamPie is a Python shell which is designed to be reliable and fun.

   - DreamPie features a new concept for an interactive shell: the window is
   divided into the *history box*, which lets you view previous commands and
   their output, and the *code box*, where you write your code. This allows
   you to edit any amount of code, just like in your favorite editor, and
   execute it when it's ready. You can also copy code from anywhere, edit it
   and run it instantly.
   - The *Copy code only* command will copy the code you want to keep, so
   you can save it in a file. The code is already formatted nicely with a
   four-space indentation.
   - Features automatic completion of attributes and file names.
   - Automatically displays function arguments and documentation.
   - Keeps your recent results in the *result history*, for later user.
   - Can automatically fold long outputs, so you can concentrate on what's
   important.
   - Lets you save the history of the session as an HTML file, for future
   reference. You can then load the history file into DreamPie, and quickly
   redo previous commands.
   - Supports interactive plotting with
matplotlibhttp://matplotlib.sourceforge.net/
   .
   - Supports Python 2.5, Python 2.6, Jython 2.5, IronPython 2.6 and Python
   3.1.
   - Works on Windows and Linux.
   - Extremely fast and responsive.
   - Free software licensed under GPL version 3.


/jeff
___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] which one is the best pythonic way .

2010-02-08 Thread Jeffrey Jose
filter, map (reduce, any, all) come from the world of Functional
Programming. For that matter list comprehension was borrowed from FP
(haskell).

I wont attempt to compare them as they cater to different needs. Yes, they
overlap in certain areas but I'd like to think of them as seperate assets
suited for different needs.

For simple stuff, List Comprehension offers superior readability but it can
get too much too fast if you start chaining a lot.

Do not overlook the power of filter, map as they _are_ valuable tools in
your everyday programming.

jeff

PS: If it interests you, read about MapReduce that Google use to come up
with lightening fast search results. yes. mapreduce = map + reduce. simple,
effective, elegant.

On Tue, Feb 9, 2010 at 10:52 AM, Srinivas Reddy Thatiparthy 
srinivas_thatipar...@akebonosoft.com wrote:


 Thanks for the replies and I avoid using lambdas..
 Btw,Shall I avoid using filter and map ?
 Because what ever filter and map do,I could seem to do the same with
 Listcomprehensions..
 Is there any situation in which they fare better than list
 comprehensions?

 Regards,
 ~ Srini T
 ___
 BangPypers mailing list
 BangPypers@python.org
 http://mail.python.org/mailman/listinfo/bangpypers

___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] using IPython from pdb

2010-02-06 Thread Jeffrey Jose
[ caution, huge email follows ]

Hey Senthil,
I was under the impression that everyone here used and loved IPython. Boy,
was I wrong.
I wont attempt to convince you folks why you should use IPython, but here a
few features that I love in IPython which are not there (or not  very
obvious) in vanilla python interpreter.

note: I'm using  for prompt, you can always customize your IPython
interpreter.

*Tab completion*. I cant live without it.
 import sys
 syTAB
 sys.TAB
sys.foo sys.bar sys.baz

 sys.getsiTAB
 sys.getsizeof

*Documentation* and *Function Signature*
 sys.getsizeof?
*Type*: builtin_function_or_method
*Base Class*:  type 'builtin_function_or_method'
*String Form*:  built-in function getsizeof
*Namespace*:   Interactive
*Docstring*:
 getsizeof(object, default) - int

 Return the size of object in bytes

*Source Code*
 import multiprocessing
 multiprocessing.os?
*[Doc, Function Signature etc]*

 multiprocessing.os??
*[opens the source code if you wanna browse around]*


Those are the top 3 things that I love about IPython interpreter. And ever
since I found them, I haven't gone back to vanilla python interpreter.

Senthil wrote,

* I am really not sure as how using IPython from pdb can help during
debugging? I tried it, I loose all the pdb's capabilities when I enter into
the IPython shell. How do people normally use it?
*

Yes, you're right. You loose all capabilities of pdb when you're in IPython
(there's a solution, i'll get to that later)
Here's my typical IPython from pdb session for debugging.

1. Insert import pdb;pdb.set_trace() the place where I suspect the problem
is. Assume the very next line throws a huge error.
2. Run the code, drop into pdb
3. Invoke IPython from pdb
 whos
# Shows all the variables in the current context
4. Poke around a lil bit, see what's the values of variables are, etc etc.
Pretty normal stuff. Couple this with IPython's excellent introspective
power you can rip apart and dig each and everything.
 import more_modules
 try_different_things(); try_different_logic();
5. Execute the next line and expect it to throw the error. See the error,
if you want, retry the same line, try different arguments. Note: You havent
progressed a line at all, you're just trying out stuff at this moment
6. Once you're done your bit, you *get out of IPython. Cntrl-D*
7*. *Back in pdb, use all of pdb's power. Step in, Execute next line, set
more breakpoints, etc etc
8. Hit c to proceed to next breakpoint.
9. Repeat Steps 3 - 8

I've never had to use print statements for debugging ever since I found pdb.
With print, you can print only a couple of variables, with IPython (pdb
actually) you have access to the entire namespace. IPython just makes
working with the huge namespace a breeze.

If you arent bored already, I'll explain a unique (weird ?) way I write code
these days.
Normally, we have 2 windows open. One python interpreter and your fav text
editor. You try out stuff before to type it in your text editor.
Here's a different approach.

Step 1: Start coding before you even try out a single bit on python
interpreter.
# myCode.py
import re
regex = re.compile(r'^b')
myList = ['foo', 'bar', 'baz']

for item in myList:
   import pdb;pdb.set_trace()

Step 2. Drop into pdb and then to IPython
Step 3. Try out your stuff *here*. You dont have to setup *myList*, *item,
regex *etc. You have everything ready waiting for you.
Step 4:
 item
*'foo'*

 regex
*_sre.SRE_Patten object at 0x123123*

 regex.TAB
 regex.matTAB
 regex.match?
*[read, find what it is, nope .. not what I wanted]*

 regex.TAB
 regex.seaTAB
 regex.search?
*[ah ha!]*

 regex.search(item)
 Cntrl-D

(pdb) c

 regex.search(item)
*_sre.SRE_Match object at 0x123123*

*# phew, my re pattern works, awesome. I didnt have to setup dummy values
and then try it out etc.*
*# If re pattern didnt work the first time, I can make a new re patten and
try it out here. Again, I am not dealing with dummy values, but its the
actual values from the code -- foo, bar, baz (think if you're reading from a
file, querying database etc.) work with real values, not dummy*

*# Again, not knowing whether it is regex.search or regex.match to use didnt
stop you from starting to code.*
*
*I call it breakpoint induced coding. Extremely helpful when you're
modifying someone else's code and you have no idea wht the heck all the code
before this was doing. Insert a breakpoint (at the potential place you'd
edit/add code) and start from there.

# someonesCode.py
import m1, m2, m3;

call_function_1()
call_function_2()
do_extreme_stuff()
call_another_setof_functions()

def do_extreme_stuff():
  s1
  s2
  potential_bug
  s3


Step 1.
s1
s2
*import pdb;pdb.set_trace()*
potential_bug
s3

Step 2: pdb - IPython
 whos
* #see what the variables are, what's the status of the program right now
etc*

 try_a_much_better_approach()
 make_sure_it_works_and_doesnt_break_anything()

Step 3: Go back to text editor and put in your stuff there.
Step 4: Peace.


If you're 

Re: [BangPypers] using IPython from pdb

2010-02-06 Thread Jeffrey Jose
Not quite long ago, I wrote,
You loose all capabilities of pdb when you're in IPython (there's a
solution, i'll get to that later)

Its called ipdb. IPythonised pdb. I havent used it to recommend it. I'm
happy with the solution that I have right now for debugging and writing
code.

Read more about it here.
http://www.electricmonk.nl/log/2008/06/25/breakpoint-induced-python-debugging-with-ipython/



On Thu, Feb 4, 2010 at 5:43 AM, Senthil Kumaran orsent...@gmail.com wrote:

 Using IPython from pdb, what use is it?
 I read Jeff's excellent mail on debugging and tracing and he insisted on
 using IPython from pdb. I have used pdb extensively and never used IPython,
 (it never caught me, given that odd interface of number[:]) etc.

 So, I am really not sure as how using IPython from pdb can help during
 debugging? I tried it, I loose all the pdb's capabilities when I enter into
 the IPython shell. How do people normally use it?

 --
 Senthil
 ___
 BangPypers mailing list
 BangPypers@python.org
 http://mail.python.org/mailman/listinfo/bangpypers

___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] using IPython from pdb

2010-02-06 Thread Jeffrey Jose
Thanks. I'll give it a spin.

btw, Can you tell me why you prefer bpython over IPython and the nifty
features I should be looking for when I try bpython ?


Jeff

On Sat, Feb 6, 2010 at 7:55 PM, Shashwat Anand anand.shash...@gmail.comwrote:

 @Jeffrey,

 bpython is a bit unstable and crash-prone but I prefer it over Ipython.

 On Sat, Feb 6, 2010 at 7:45 PM, Jeffrey Jose jeffjosej...@gmail.com
 wrote:

  [ caution, huge email follows ]
 
  Hey Senthil,
  I was under the impression that everyone here used and loved IPython.
 Boy,
  was I wrong.
  I wont attempt to convince you folks why you should use IPython, but here
 a
  few features that I love in IPython which are not there (or not  very
  obvious) in vanilla python interpreter.
 
  note: I'm using  for prompt, you can always customize your IPython
  interpreter.
 
  *Tab completion*. I cant live without it.
 

 bpython supports tab-completion


   import sys
   syTAB
   sys.TAB
  sys.foo sys.bar sys.baz
 
   sys.getsiTAB
   sys.getsizeof
 
  *Documentation* and *Function Signature*
 

 bpython supports these features


   sys.getsizeof?
  *Type*: builtin_function_or_method
  *Base Class*:  type 'builtin_function_or_method'
  *String Form*:  built-in function getsizeof
  *Namespace*:   Interactive
  *Docstring*:
  getsizeof(object, default) - int
 
  Return the size of object in bytes
 
  *Source Code*
   import multiprocessing
   multiprocessing.os?
  *[Doc, Function Signature etc]*
 
   multiprocessing.os??
  *[opens the source code if you wanna browse around]*
 
 
  Those are the top 3 things that I love about IPython interpreter. And
 ever
  since I found them, I haven't gone back to vanilla python interpreter.
 
  Senthil wrote,
 
  * I am really not sure as how using IPython from pdb can help during
  debugging? I tried it, I loose all the pdb's capabilities when I enter
 into
  the IPython shell. How do people normally use it?
  *
 
  Yes, you're right. You loose all capabilities of pdb when you're in
 IPython
  (there's a solution, i'll get to that later)
  Here's my typical IPython from pdb session for debugging.
 
  1. Insert import pdb;pdb.set_trace() the place where I suspect the
 problem
  is. Assume the very next line throws a huge error.
  2. Run the code, drop into pdb
  3. Invoke IPython from pdb
   whos
  # Shows all the variables in the current context
  4. Poke around a lil bit, see what's the values of variables are, etc
 etc.
  Pretty normal stuff. Couple this with IPython's excellent introspective
  power you can rip apart and dig each and everything.
   import more_modules
   try_different_things(); try_different_logic();
  5. Execute the next line and expect it to throw the error. See the
 error,
  if you want, retry the same line, try different arguments. Note: You
 havent
  progressed a line at all, you're just trying out stuff at this moment
  6. Once you're done your bit, you *get out of IPython. Cntrl-D*
  7*. *Back in pdb, use all of pdb's power. Step in, Execute next line, set
  more breakpoints, etc etc
  8. Hit c to proceed to next breakpoint.
  9. Repeat Steps 3 - 8
 
  I've never had to use print statements for debugging ever since I found
  pdb.
  With print, you can print only a couple of variables, with IPython (pdb
  actually) you have access to the entire namespace. IPython just makes
  working with the huge namespace a breeze.
 
  If you arent bored already, I'll explain a unique (weird ?) way I write
  code
  these days.
  Normally, we have 2 windows open. One python interpreter and your fav
 text
  editor. You try out stuff before to type it in your text editor.
  Here's a different approach.
 
  Step 1: Start coding before you even try out a single bit on python
  interpreter.
  # myCode.py
  import re
  regex = re.compile(r'^b')
  myList = ['foo', 'bar', 'baz']
 
  for item in myList:
import pdb;pdb.set_trace()
 
  Step 2. Drop into pdb and then to IPython
  Step 3. Try out your stuff *here*. You dont have to setup *myList*,
 *item,
  regex *etc. You have everything ready waiting for you.
  Step 4:
   item
  *'foo'*
 
   regex
  *_sre.SRE_Patten object at 0x123123*
 
   regex.TAB
   regex.matTAB
   regex.match?
  *[read, find what it is, nope .. not what I wanted]*
 
   regex.TAB
   regex.seaTAB
   regex.search?
  *[ah ha!]*
 
   regex.search(item)
   Cntrl-D
 
  (pdb) c
 
   regex.search(item)
  *_sre.SRE_Match object at 0x123123*
 
  *# phew, my re pattern works, awesome. I didnt have to setup dummy values
  and then try it out etc.*
  *# If re pattern didnt work the first time, I can make a new re patten
 and
  try it out here. Again, I am not dealing with dummy values, but its the
  actual values from the code -- foo, bar, baz (think if you're reading
 from
  a
  file, querying database etc.) work with real values, not dummy*
 
  *# Again, not knowing whether it is regex.search or regex.match to use
  didnt
  stop you from starting to code.*
  *
  *I call it breakpoint induced

Re: [BangPypers] using IPython from pdb

2010-02-06 Thread Jeffrey Jose
Hey Noufal,

I'm not sure what you mean by standard email quotations. FYI, I just went
back and checked my mail in gmail and it shows up fine, so the formatting's
not screwed up (I get a lot, when you sent it as simple text and it has a
_lot_ of *this*)

Jeff


On Sat, Feb 6, 2010 at 10:39 PM, Noufal Ibrahim nou...@gmail.com wrote:

 I'd recommend that you use standard email quotations. It makes for
 better reading rather than the * notation that you've used to reply to
 Senthil's mail.

 On Sat, Feb 6, 2010 at 7:45 PM, Jeffrey Jose jeffjosej...@gmail.com
 wrote:
  [ caution, huge email follows ]
 
  Hey Senthil,
  I was under the impression that everyone here used and loved IPython.
 Boy,
  was I wrong.
  I wont attempt to convince you folks why you should use IPython, but here
 a
  few features that I love in IPython which are not there (or not  very
  obvious) in vanilla python interpreter.
 
  note: I'm using  for prompt, you can always customize your IPython
  interpreter.
 
  *Tab completion*. I cant live without it.
  import sys
  syTAB
  sys.TAB
  sys.foo sys.bar sys.baz

 The vanilla Python interpreter can be customised to do this.
 http://docs.python.org/library/rlcompleter.html

 The Emacs integration of ipython is quite nice. I don't use it *that*
 much but it's still pretty good especially to jump around a traceback
 when your program crashes. I don't like leaving Emacs to do something
 since I have to switch context. Being able to mess with your program
 entirely from within is a convenience and the ipython.el module helps
 quite a bit.


 --
 ~noufal
 http://nibrahim.net.in
 ___
 BangPypers mailing list
 BangPypers@python.org
 http://mail.python.org/mailman/listinfo/bangpypers

___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] Python Maintainence code: Debugging, Tracing and Profiling help

2010-01-24 Thread Jeffrey Jose
Hi Anand,

I can talk a lil bit about your 2 queries. Debugging and seeing the flow of
the program.

*A. Debugging*

Surprisingly both of them come under the same banner. One of the reasons you
debug is to see how the code progresses. For debugging I highly recommend
Python Debugger. It would look a lot odd the first time you invoke it, but
trust me with a few neat tricks you'd be using it all the time.

There's just one thing you need to do to summon the Python Debugger. Insert
this one line in your code.

import pdb; pdb.set_trace()

The next time you run the code, it would drop into the debugger (you just
set a trace point). When you have the debugger prompt, you have access to
all the variables, stacktrace etc. You need to know a few commands to get
around.

c - Continue (till the end of the program or till the next breakpoint)
n - Execute next step
l - See where you are
s - Step into a function.

I accept this is not a natural way of doing things.. That's where we come to
the 'with-a-few-tricks-you'd-be-doing-this-all-the-time'
And the trick is this. Invoke Ipython from pdb. The good thing is you get
tab-competition (which pdb lacks). You can try out all kinds of things.
Introspect, import other modules, try and see the next line and see what its
output 'would be'. Its sweet. I highly recommend you take a look at this.

Starting ipython from
pdbhttp://libreamoi.com/index.php/starting-ipython-from-pdb/-
http://libreamoi.com/index.php/starting-ipython-from-pdb/
Hit Ctrl-D to exit from Ipython to go to pdb again and hit 'c' to continue
the program. While you're at pdb, you can still go into ipython again.

Remember Ipython is a regular prompt, so you cant do debugger-y things like
Step Into, Continue etc. For that you'll have to come 'out' of Ipython to
pdb. You can go back to Ipython anytime.

*B. Seeing Your Program Flow*

If I understand you correctly, I've seen this problem hit me lot of times.
If you're working on others code, and all of a sudden you wanna
understand/fix them - you'd be sitting there thinking - Damn, *how* does
this code work. I can see a lot of functions and I get what it does. But
when does this one get called. I see this main call from main() .. but is
there another place where it gets called ?. If so what are the arguments.
What does it return on this one specific call etc.

While its technically possible to do next-next-next using Python Debugger to
step through the program and sometimes that's all can you do.
But there's a much better way than inserting

print Called me!
print Done with me!

etc.

The idea here is to use sys.settrace() to insert to a utility function which
gets called before any important events. Events include,
# execution of any line (that means all the time)
# calling a function
# return from a function
# encountering an exception

This means your utility function can go .. hmm .. is this a function call ?
.. if so gimme the name of the caller and name of the function and let me
print it.

When you run the code you'd get a huge output with prints which shows the
flow of the program.
Again, refer this page for a better understanding.
Tracing Your Program As It Runs -
http://blog.doughellmann.com/2009/11/pymotw-sys-part-5-tracing-your-program.html
One caution : Do Not Abuse sys.settrace() Use sys.settrace() for debugging
only. You might be tempted to do crazy things like .. during every function
call .. I'll authorize the user or something. That better be done using
different methods. Just saying :)


Unfortunately, the place where I work doesnt care much about performance (or
unnecessary optimization) for the python code. So I cant help you there.
I'll let others chip in for those stuff.

HTH
Jeff


On Sun, Jan 24, 2010 at 4:34 AM, learningpyt...@aol.com wrote:




  Hi Experts,

 I am back to python after a while of just formal introduction. Thistime i
 have to manage a huge files with numerous functions, i am debugging a issue
 right now and would require to understand the flow ofthe code.

 Please can you help me on what can i do to have better understanding ofthe
 profiling of classes, defs invoked each time and how to read them.

 The ones i plan to do is to insert lot of prints in every class, defs ex:
 print self.__class__.__name__ in every def, to see the flow which is tedious
 and time consuming as the size of files and project is huge.

 Any suggestions please and advice please.

 PS: how to post to comp.lang.python newsgroup please??


 Cheers
 Anand





 ___
 BangPypers mailing list
 BangPypers@python.org
 http://mail.python.org/mailman/listinfo/bangpypers

___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] January user group meeting

2010-01-22 Thread Jeffrey Jose

 Do you folks upload the presentation/audio/video somewhere? I am much
 interested in the buildbot talks.

 -srid


On Tue, Jan 19, 2010 at 10:37 PM, Jeffrey Jose jeffjosej...@gmail.com
wrote:
 Unfortunately I wont be able to attend, @Baiju, will you be making your
talk
 available online?

I am afraid that would be possible as we don't have facilities for that.
And it's not going to be very formal talk.

Regards,
Baiju M


Jeff
___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] Help plzz..

2010-01-20 Thread Jeffrey Jose
+1 for both Byte of Python and Dive into Python

Also, Python CookBook

Once you've familiarised with the language (I didnt say mastered it) hit
video.google.com for some excellent Google Tech Talks in the field of python
including Python Giants like Alex Martelli


I've also found stackoverflow.com to be an excellent place to hangout for
tips tricks and pitfalls

jeff

On Wed, Jan 20, 2010 at 6:15 PM, JAGANADH G jagana...@gmail.com wrote:

 On Wed, Jan 20, 2010 at 6:04 PM, Diptanu Choudhury
 admin.nitj...@gmail.comwrote:

  I felt that Dive into Python can be a little tough to begin with. The
  tutorial on docs.python.com was easier to follow for me when I started
  out.
  But having said that, it depends on the person.
 
  A friend of mind found Dive into Python a little humorous and he totally
  loved it. :-)
 
 
 Try Head First Programming

 oreilly.com/catalog/9780596802387


 --
 **
 JAGANADH G
 http://jaganadhg.freeflux.net/blog
 ___
 BangPypers mailing list
 BangPypers@python.org
 http://mail.python.org/mailman/listinfo/bangpypers

___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers