Re: How to check what is holding reference to object

2010-05-05 Thread Marius Gedminas
e to do that just looking to the code > or debugging it because it is pretty complicated, but I am able to > invoke this situation again. I wrote http://pypi.python.org/pypi/objgraph for this purpose. -- Marius Gedminas -- http://mail.python.org/mailman/listinfo/python-list

Re: How to check what is holding reference to object

2010-05-05 Thread Marius Gedminas
ed >>> import gc >>> gc.get_referrers(42) ? Marius Gedminas -- http://mail.python.org/mailman/listinfo/python-list

Re: Python-URL! - weekly Python news and links (Feb 9)

2010-02-09 Thread Marius Gedminas
  Call-By-Reference?" thread of the year! >        http://groups.google.com/group/comp.lang.pythonfd36962c4970ac487ea/ Any chance of getting them fixed? Regards, -- Marius Gedminas -- http://mail.python.org/mailman/listinfo/python-list

Re: Python and Ruby

2010-02-04 Thread Marius Gedminas
way. Someone already did: "Advanced Python or Understanding Python" http://video.google.com/videoplay?docid=7760178035196894549 (76 minutes). Worth watching. Regards, -- Marius Gedminas -- http://mail.python.org/mailman/listinfo/python-list

Re: Application-global "switches"?

2009-09-17 Thread Marius Gedminas
On Sep 4, 9:29 pm, kj wrote: > The only solution I can come up with is to define a "dummy module", > say _config.py, which contains only upper-case variables representing > these global switches, and is imported by all the other modules in > the application with the line "from _config import *".  

Re: your favorite debugging tool?

2009-09-03 Thread Marius Gedminas
On Aug 25, 2:55 pm, Esmail wrote: > Re pdb, if you have a 'pointer' (ie reference) to an object, is there > an easy way to dump out its contents, ie all of its members short of > writing a method that does that and then calling it? Usually pp vars(your_object) does what you want -- http://ma

Re: extract to dictionaries

2009-05-29 Thread Marius Retegan
Hi, On Fri, May 29, 2009 at 2:09 AM, Gary Herron wrote: > Marius Retegan wrote: > >> Hello >> I have simple text file that I have to parse. It looks something like >> this: >> >> parameters1 >> key1 value1 >> key2 value2 >> end &

extract to dictionaries

2009-05-28 Thread Marius Retegan
Hello I have simple text file that I have to parse. It looks something like this: parameters1 key1 value1 key2 value2 end parameters2 key1 value1 key2 value2 end So I want to create two dictionaries parameters1={key1:value1, key2:value2} and the same for parameters2. I woud

Re: Q's on my first python script

2009-05-14 Thread Marius Gedminas
!") The warnings module is used for warnings about program code, not user input. import logging logging.warn("Oh noes, you passed me two arguments instead of one!") -- Marius Gedminas -- http://mail.python.org/mailman/listinfo/python-list

Re: Q's on my first python script

2009-05-14 Thread Marius Gedminas
eString, e: >             print usage >             print e >             sys.exit(1) I would recommend printing error messages to sys.stderr. BTW, in this particular case you may want to use parser.error(e) instead of print + sys.exit. -- Marius Gedminas -- http://mail.python.org/mailman/listinfo/python-list

Load / Reload module

2009-02-04 Thread Marius Butuc
ctive interpreter. So far I have tried - import classes # doesn't import my classes - from classes import * # imports, but I can't reload - reload(classes) # I have the same class definition after this I've tried the documentation but I got lost, so please h

Wing IDE 101 (new freeware version) works with Python 2.6

2008-10-03 Thread Marius
Wing IDE 101 Version: 3.1.4-1 (rev 18789) Release Date: September 18, 2008 from http://www.wingware.com/wingide-101 "Wing IDE 101 is a free basic edition of Wing IDE that was designed with the University of Toronto Computer Science Department for teaching entry level computer science courses with

Re: Python Generators

2008-03-18 Thread Marius Gedminas
;> concat([[1,2], [3, 4], [5], [6, 7, 8]]) >>> list(concat([[1,2], [3, 4], [5], [6, 7, 8]])) [1, 2, 3, 4, 5, 6, 7, 8] wondering if google groups will add a .sig or not-ly, Marius Gedminas -- http://mail.python.org/mailman/listinfo/python-list

Re: Collections of non-arbitrary objects ?

2007-06-25 Thread Marius Gedminas
On Jun 24, 2:12 pm, Bjoern Schliessmann wrote: > 7stud wrote: > > if hasattr(elmt, some_func): > >elmt.some_func() > > Personally, I prefer > > try: > elmt.some_func() > except AttributeError: > # do stuff That also hides attribute errors that occur within some_func. I think I'd rath

Re: *Naming Conventions*

2007-06-11 Thread Marius Gedminas
On Jun 6, 3:18 pm, Neil Cerutti <[EMAIL PROTECTED]> wrote: > > Since 'i' and 'j' are canonically loop indices, I find it > > totally confusing to use them to name the iteration variable - > > which is not an index. > > Certainly i and j are just as generic, but they have the > advantage over 'item'

Re: How do you use this list ?

2006-06-27 Thread Marius Ursache
Bo Yang wrote: > Hi everyone , > I have join this list for about 4 months , and everyday I receive > hundreds of > mails . There is no means to read all of them , so I just read something > interesting > for me . But if so , there are too much mails pile up in my inbox , I > want to ask > how do y

Re: md5 from python different then md5 from command line

2006-05-07 Thread Marius Ursache
> echo adds a newline: > >>>> import md5 > >>> test = md5.new("marius\n") >>>> print test.hexdigest() >0f0f60ac801a9eec2163083a22307deb > > Just Thanks, that was it ;) -- http://mail.python.org/mailman/listinfo/python-list

Re: days since epoch

2006-02-17 Thread Marius Gedminas
The datetime module is usually more convenient for date/time arithmetic. However in your particular case, you may find the time.time() function convenient. It returns the number of seconds since the epoch. To get the number of days divide the number of seconds by 86400. -- http://mail.python.o

Re: understanding stat module names

2006-01-18 Thread Marius Gedminas
David Bear wrote: > I'm trying to use os.chmod and am refered to the stat module. > > Is there are explanation of: > * S_ISUID ... > * S_IXOTH These come from the POSIX standard. See http://www.opengroup.org/onlinepubs/007908799/xsh/sysstat.h.html HTH, Mariu

Re: python coding contest

2005-12-30 Thread Marius Gedminas
I managed it with vim. -- http://mail.python.org/mailman/listinfo/python-list

Re: python coding contest

2005-12-29 Thread Marius Gedminas
I cannot reach the contest site at since all this morning. :-( -- http://mail.python.org/mailman/listinfo/python-list

Re: python coding contest

2005-12-29 Thread Marius Gedminas
I cannot not reach the contest site at since all this morning. :-( -- http://mail.python.org/mailman/listinfo/python-list

Re: python coding contest

2005-12-28 Thread Marius Gedminas
Jean-Paul Calderone wrote: > On Tue, 27 Dec 2005 14:02:57 -0700, Tim Hochberg <[EMAIL PROTECTED]> wrote: > >Shane Hathaway wrote: > >> Paul McGuire wrote: > >> > >> > >> Also, here's another cheat version. (No, 7seg.com does not exist.) > >> > >>import urllib2 > >>def seven_seg(x):return u

Re: efficient 'tail' implementation

2005-12-15 Thread Marius Gedminas
Magnus Lycka wrote: > To read the last x bytes of a file, you could do: > > >>> import os > >>> x = 2000 # or whatever... > >>> f=open('my_big_file') > >>> l=os.fstat(f.fileno()).st_size > >>> f.seek(l-x) > >>> f.read() You don't need fstat/st_size, you can ask seek to move to an offset rela

Re: Is Python like VB?

2005-03-17 Thread Groleo Marius
Maybe you should ask : Is VB like Python ( remark the ) On 17 Mar 2005 09:45:22 +0200, Ville Vainio <[EMAIL PROTECTED]> wrote: > > "Cappy" == Cappy2112 <[EMAIL PROTECTED]> writes: > > Cappy> VB has a much better IDE than the IDE's for Python, > Cappy> although Eric3 is one

executea string

2005-02-22 Thread Groleo Marius
I have the folowing code: c=2 e=3 s="12" code.append('funtion ("c, e,s")') print "\n".join(code) + '\n' The problem is when i call append. The variables s, c, e are not replaced with their value, so in the end i get the result: funtion(" c, e, s"); The result that i want is : funtion("2,3,1

Execute a list

2005-02-22 Thread Groleo Marius
Hi. How can i execute a string in python? For example if I have the variable s, defined below s = '"print "hello"' How can I execute the code that "s" keeps inside, considering that the code is correct? -- http://mail.python.org/mailman/listinfo/python-list

Re: python versions of perl modules

2004-12-30 Thread Marius Bernklev
* [EMAIL PROTECTED] > So is that a yes or a no to the man's question? Of course it is. -- Marius Bernklev Holmgang: Deodoranter har parfyme, mens folk bare kaster kaffegruten. Bør nye PC-er inkludere ekstra USB-kabel? Vi tar debatten! -- http://mail.python.org/mailman/listinf

Re: Why tuples use parentheses ()'s instead of something else like <>'s?

2004-12-28 Thread Marius Bernklev
* [EMAIL PROTECTED] > Perhaps ()'s are a good idea for some other reason I don't know? One-element tuples are written as (4,). -- Marius Bernklev http://www.ping.uio.no/~mariube/ > -- http://mail.python.org/mailman/listinfo/python-list