Re: Question on for loop

2013-03-04 Thread Bryan Devaney
> if character not in lettersGuessed:
> 
> return True
> 
> return False

assuming a function is being used to pass each letter of the letters guessed 
inside a loop itself that only continues checking if true is returned, then 
that could work.

It is however more work than is needed. 

If you made secretword a list,you could just 

set(secretword)&set(lettersguessed) 

and check the result is equal to secretword.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: i need help

2013-03-04 Thread Bryan Devaney
On Sunday, March 3, 2013 6:45:26 PM UTC, Kwpolska wrote:
> On Sun, Mar 3, 2013 at 7:46 AM, Michael Torrie  wrote:
> 
> > On 02/21/2013 03:18 AM, leonardo wrote:
> 
> >> thanks, problem solved
> 
> >
> 
> > Apparently not.  The shift key on your keyboard still seems to be
> 
> > non-functional. ;)
> 
> > --
> 
> > http://mail.python.org/mailman/listinfo/python-list
> 
> 
> 
> It is!  How else could he type those two question marks and 10 double-quotes?
> 
> 
> 
> -- 
> 
> Kwpolska  | GPG KEY: 5EAAEA16
> 
> stop html mail| always bottom-post
> 
> http://asciiribbon.org| http://caliburn.nl/topposting.html

Onscreen Keyboard?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Question on for loop

2013-03-05 Thread Bryan Devaney
On Monday, March 4, 2013 4:37:11 PM UTC, Ian wrote:
> On Mon, Mar 4, 2013 at 7:34 AM, Bryan Devaney  wrote:
> 
> >> if character not in lettersGuessed:
> 
> >>
> 
> >> return True
> 
> >>
> 
> >> return False
> 
> >
> 
> > assuming a function is being used to pass each letter of the letters 
> > guessed inside a loop itself that only continues checking if true is 
> > returned, then that could work.
> 
> >
> 
> > It is however more work than is needed.
> 
> >
> 
> > If you made secretword a list,you could just
> 
> >
> 
> > set(secretword)&set(lettersguessed)
> 
> >
> 
> > and check the result is equal to secretword.
> 
> 
> 
> Check the result is equal to set(secretword), I think you mean.
> 
> 
> 
> set(secretword).issubset(set(lettersguessed))
> 
> 
> 
> might be slightly more efficient, since it would not need to build and
> 
> return an intersection set.
> 
> 
> 
> One might also just do:
> 
> 
> 
> all(letter in lettersguessed for letter in secretword)
> 
> 
> 
> Which will be efficient if lettersguessed is already a set.

You are correct. sorry for the misleading answer, was digging through old shell 
scripts all day yesterday and brain was obviously not not the better for it.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: book advice

2013-03-05 Thread Bryan Devaney
On Friday, March 1, 2013 8:59:12 PM UTC, leonardo selmi wrote:
> hi
> 
> 
> 
> is there anyone can suggest me a good book to learn python? i read many but 
> there is always something unclear or examples which give me errors.
> 
> how can I start building a sound educational background
> 
> 
> 
> thanks for any help 
> 
> 
> 
> best regards

If you have net access and are learning your first programming language, I'd 
say head on over to one of the free web python courses that include an online 
interpreter. It sorts out a great deal of the 'incompatible version' problems 
people have with offline tutorials. I'm not sure what the policy is in regards 
linking to one so I'll just say Google one.  

Once you've found your feet, I do hear good things about 'learn python the hard 
way' but I've not read it myself. 

Generally once you've covered the foundations and understand the terms, 
Python.org's docs are very good.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: sync databse table based on current directory data without losign previous values

2013-03-06 Thread Bryan Devaney
On Wednesday, March 6, 2013 9:43:34 AM UTC, Νίκος Γκρ33κ wrote:
> Perhaps because my filenames is in greek letters that thsi error is presented 
> but i'am not sure.
> 
> 
> 
> Maybe we can join root+files and store it to the set() someway differenyl

well, the error refers to the line "if b.startswith('/'): " and states "'list' 
object has no attribute 'startswith'" 

so b is assigned to a list type and list does not have a 'startswith' method or 
attribute.

I Thought .startswith() was a string method but if it's your own method then I 
apologize (though if it is, I personally would have made a class that inherited 
from list rather than adding it to list itself)

can you show where you are assigning b (or if its meant to be a list or string 
object)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Set x to to None and del x doesn't release memory in python 2.7.1 (HPUX 11.23, ia64)

2013-03-06 Thread Bryan Devaney
On Wednesday, March 6, 2013 10:11:12 AM UTC, Wong Wah Meng-R32813 wrote:
> Hello there,
> 
> 
> 
> I am using python 2.7.1 built on HP-11.23 a Itanium 64 bit box. 
> 
> 
> 
> I discovered following behavior whereby the python process doesn't seem to 
> release memory utilized even after a variable is set to None, and "deleted". 
> I use glance tool to monitor the memory utilized by this process. Obviously 
> after the for loop is executed, the memory used by this process has hiked to 
> a few MB. However, after "del" is executed to both I and str variables, the 
> memory of that process still stays at where it was. 
> 
> 
> 
> Any idea why?
> 
> 
> 
> >>> for i in range(10L):
> 
> ... str=str+"%s"%(i,) 
> 
> ... 
> 
> >>> i=None
> 
> >>> str=None
> 
> >>> del i
> 
> >>> del str

Hi, I'm new here so I'm making mistakes too but I know they don't like it when 
you ask your question in someone else's question. 

that being said, to answer your question:

Python uses a 'garbage collector'. When you delete something, all references 
are removed from the object in memory, the memory itself will not be freed 
until the next time the garbage collector runs. When that happens, all objects 
without references in memory are removed and the memory freed.  If you wait a 
while you should see that memory free itself.
-- 
http://mail.python.org/mailman/listinfo/python-list