Re: [Tutor] Practice Exercises for Beginner ?

2016-06-03 Thread Andrei Colta
hi guys, Thanks all for input, if anything else.. please let me know. cheers, Andrei > On 03 Jun 2016, at 11:14, Alan Gauld via Tutor wrote: > > On 02/06/16 21:43, Andrei Colta wrote: >> Hi, >> >> Anyone can recommend practical work on learning python.. seems readi

[Tutor] Practice Exercises for Beginner ?

2016-06-02 Thread Andrei Colta
Hi, Anyone can recommend practical work on learning python.. seems reading and reading does not helping. Thanks in advance, Andrei ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman

Re: [Tutor] Help Learn python - Step by Step

2015-05-09 Thread Andrei Colta
Thanks for sharing, will try it. Cheers, Andrei On 9 May 2015 15:45, "Nym City" wrote: > I am on the same boat. I have tried using online sites like codeacademy > and courses on courser but now I am starting with this new book called > "Automate The Boring Stuff with

Re: [Tutor] Creating Sudoku

2008-04-07 Thread Andrei Petre
A good place to look at : http://www.norvig.com/sudoku.html On Mon, Apr 7, 2008 at 6:53 PM, Luke Paireepinart <[EMAIL PROTECTED]> wrote: > W W wrote: > > On 4/7/08, Luke Paireepinart <[EMAIL PROTECTED]> wrote: > > > >> W W wrote: > >> What are you talking about? I don't understand what you mean

Re: [Tutor] crashed with Runtime Error: NZEC (non-zero exit code)

2008-02-27 Thread Andrei Petre
i'm thinking the same way Eric do. On Wed, Feb 27, 2008 at 11:18 PM, Eric Brunson <[EMAIL PROTECTED]> wrote: > Alan Gauld wrote: > > "bob gailer" <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> wrote > > > > i don't really understand that. you are trying to say that the > tests > from the online judge

[Tutor] crashed with Runtime Error: NZEC (non-zero exit code)

2008-02-24 Thread Andrei Petre
write(number) [/code] Any alternatives for the personal rambling(if it's a wrong way to do it, of course): L = [1,2,[3,4],[5,5]] for item in L: if type(item) == list: print L[item[0]], L[item[1]] else: print L[item] Thanks, Andrei import sys def write(numb

[Tutor] read from standard input

2008-02-13 Thread Andrei Petre
Hello, I want to read from the standard input numbers until i reach a certain value or to the end of the "file". What is the simplest, straightforward, pythonic way to do it? a sketch of how i tried to do it: [code] while 1 < 2: x = raw_input() if type(x) != int or x == 11: break

Re: [Tutor] Calculator research

2007-06-02 Thread Andrei
Glade - you can design your interface in a point-and-click manner. You will need to learn a bit about wxPython in the process, but don't have to become an expert. -- Yours, Andrei = Mail address in header catches spam. Real contact info: ''.join([''.join(s) for s in

Re: [Tutor] Custom metaclass?

2007-04-19 Thread Andrei
around all this metaclass safety by adding using this code: NoNewAttrs.__metaclass__.__setattr__ = type.__setattr__ NoNewAttrs.__setattr__ = object.__setattr__ nna.x = 5 print 'After reset: nna.x =', nna.x Run this and you'll see

Re: [Tutor] ConfigParser and multiple option names

2007-04-07 Thread Andrei
552211', '"/home/whoever"'), ('dir0.8258732656650.272559810163', '"/home/florian"'), ('dir0.6565224032210.703769464586', '"/home/john"')] Note that it will do this for *all* options in your file, even

Re: [Tutor] Communication between classes

2007-04-02 Thread Andrei
owHelp() else: fileop.Perform() Adding new operations would be a matter of implementing an appropriate class and adding it to the operations dictionary. With a bit of Python magic you could even get the operation classes to auto-register, so just writing an operation class would

Re: [Tutor] Communication between classes

2007-04-01 Thread Andrei
es if you need getter/setter methods or simple attributes otherwise. In your case, I would not make __filename etc. 'private' (that's what the double underscore suggests), then write a getter method for it - just call it FileName and be done with it. Python idiom here is more flexi

[Tutor] tokenizing a simple string with split()

2007-03-31 Thread Andrei Petre
n may consist of multiple characters". But I cannot figured out why this simple example not working: s = "spam;egg mail" s.split("; ") output: ['spam;egg mail'] instead of ['spam', 'egg', 'mail'] any suggestion is welcome, andre

Re: [Tutor] Another parsing question

2007-03-31 Thread Andrei
yourself, movie stars, pets or other frivolities - flattering as it may be - will become problematic when a couple of months later you're wondering why the application crashes upon adding Fido to DarthVader, appending the result to ApplePie and writin

Re: [Tutor] Developing a GUI application

2007-03-23 Thread Andrei
and my app is yet another CDROM > database program; more details available if it matters.) -- Yours, Andrei = Mail address in header catches spam. Real contact info: ''.join([''.join(s) for s in zip( "[EMAIL PROTECTED] pmfe!Pes ontuei ulcpss edtels,s hr' on

Re: [Tutor] What/Why this Cookbook recipe?

2007-03-08 Thread Andrei
ving to manually update who knows how many translations whenever you decide to rename a variable On the other hand, having the variable name in there may give the translator useful information about the way he should translate a string, as the translation may be in

Re: [Tutor] What/Why this Cookbook recipe?

2007-03-06 Thread Andrei
r 'Name: %s' string and he gives you 'Borkbork: %s' or whatever. The translation doesn't need to be modified if you decide to make a user class and get rid of the username and userage vars. - format strings give you more control, so you can e.g. specify how many digits

Re: [Tutor] Yet another list comprehension question

2007-03-03 Thread Andrei
.keys() ... [1,2,3,4] The set solution is the Most Obvious Way to do it, but the dict one doesn't require an understanding of list comprehensions. -- Yours, Andrei = Mail address in header catches spam. Real contact info: ''.join([''.join(s) for s in zi

Re: [Tutor] dictionaries and memory handling

2007-03-03 Thread Andrei
articular time? Not as such. In your case, I think the task manager would be enough. You only have this one demanding data structure I assume, so in a rough approximation you can pretend that whatever the task manager reports (have a look at VM and peak memory usage columns, not just memory u

Re: [Tutor] geeks like us and the rest of THEM

2007-03-03 Thread Andrei
ome webscraping if the files are not readily modifiable. Its setup is about 350 kB. In terms of installers, NSIS (with the package to make it look modern, instead of that awful default look - forgot its name) or InnoSetup are the usual suspects. NSIS has a smaller overhead, but an uglier langu

Re: [Tutor] Yet another list comprehension question

2007-03-02 Thread Andrei
gt; > > > doesn't work (not that I expected it to). > > Why not use a Set? > > s = Set([somefun(i) for i in some-iterator]) > Alternatively, you could put the results as keys in a dictionary, then request mydict.keys() to get a list of unique outcomes. Yours, An

Re: [Tutor] class methods as argument

2007-02-10 Thread Andrei
_init__(self, x): self.x = x ... def dostuff(self, arg): ... print self.x ... print arg ... >>> def dostuff(obj, method): ... method(obj, 'blabla') ... >>> a = A(5) >>> dostuff(a, A.dostuff) 5 # this demonstate

Re: [Tutor] Of integers, relations and trees

2006-12-09 Thread Andrei
a child, otherwise they're unrelated. > I can't seem to rack my brains around a solution for this. Maybe it's > my tree-structure that is making this more complex than it should be? Hierarchies are easier if you look at them as families: it's easier to ask a parent how many children it has, than it is to ask one of the siblings if there is any sibling younger than it, then ask that younger sibling if it has any younger siblings, etc. Yours, Andrei ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] OOP and Python.. a gentle remark

2006-10-25 Thread Andrei
ses very cumbersome to deal with, or trusting the programmer to do the right thing - thereby making it easier to stick his grubby little fingers in places where he shouldn't. Some people prefer the former, some the latter. Yours, Andrei ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Evaluate my script?

2006-10-24 Thread Andrei
ing is potentially dangerous. Say I accidentally specify p=2atn. The program will calculate with 2 kPa, but I wouldn't know that. If instead it displayed its interpretation of my input by writing "p = 2 kPa" to the screen, I'd have a better chance of noticing. Alternatively

Re: [Tutor] Workaround for limitation in xrange()?

2006-10-10 Thread Andrei
ested), but it will take anything you throw at it as long as Python itself can handle it. Yours, Andrei ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] e-learning Python

2006-09-28 Thread Andrei
ewed by a teacher in a more classical approach. Yours, Andrei ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] e-learning Python

2006-09-26 Thread Andrei
PA sapo.pt> writes: > Is there any site offering e-learning about Python? > > If not, the PSF should do it! If you mean if there are any online tutorials: lots of them. Here's a very large list: http://www.awaretek.com/tutorials.htm

Re: [Tutor] Efficient programming questions. Tuples vs Li sts; Custom Objects vs Lists.

2006-09-25 Thread Andrei
od on a certain object, without knowing what that object is - it needs to examine the object at runtime to determine if the method is available. The potential compiler would have to handle all of these cases, meaning you'd end up with... well, CPython. Typical compiler efforts in the past have limited the flexibility of the language. Yours, Andrei ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Question about startswith() and endswith() in 2.5

2006-09-25 Thread Andrei
are not specified. You could read it like "if the filename ends with .gif or .jpg or .tiff". In older Python versions, you could implement the same functionality as: if s.endswith('.gif') or s.endswith('.jpg') or s.endswith('.tiff') This is in co

Re: [Tutor] Lists in lists

2006-09-16 Thread Andrei
ll take item #0 in MyList and request its item #1. It's equivalent to saying MySubList = MyList[0] print MySubList[1] In an interactive session: >>> li = [[1,2], [3,4]] >>> li[0] [1, 2] >>> li[0][0] 1 >>> li[0][1] 2 >>> li[1][1] 4 Yours, Andr

Re: [Tutor] Limitation of range() function in Walking problem

2006-09-16 Thread Andrei
rted locs:", locs maxrange = locs[0][:] # guaranteed to start with min for loc in locs[1:]: # loop over rest of locs if loc[0] <= maxrange[1]: maxrange[1] = loc[1] else: print " discontinuity found for", loc return None

Re: [Tutor] python for web developing

2006-09-14 Thread Andrei
Py, which is part of TurboGears) seems to have decent support for all kinds of Python things, but it's paid - if they allow a 1-month account, you could try it out for very little money over there. Yours, Andrei ___ Tutor maillist - Tutor@python.o

Re: [Tutor] Some questions about my yen-USD.py

2006-09-08 Thread Andrei
for function names is that they should contain a (well chosen) verb and an object. As always it ends up being a matter of personal taste. I for example might call that function insertSeparators or formatNumber, but other people might prefer longer names

Re: [Tutor] Some questions about my yen-USD.py

2006-09-07 Thread Andrei
ith '%%'. E.g.: >>> "%%.%df" % 2 # the '%%' will be changed to '%' in the result '%.2f' >>> "%%.%df" % 4 '%.4f' >>> s1 = "%%.%df" % 2 >>> print s1, s1 % 3.41234 '%.2f', '3.41' >>> s2 = "%%.%df" % 4 >>> print s2, s2 % 3.41234 '%.4f', '3.4123' >>> ("%%.%df" % 2) % 3.23423 '3.23' Yours, Andrei ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Some questions about my yen-USD.py

2006-09-07 Thread Andrei
cript, this difference is of no consequence (that value is close enough to zero): >>> "%.2f" % (.1+.1+.1-.3) '0.00' Andrei ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] python & mysql question

2006-09-07 Thread Andrei
Patricia gmail.com> writes: > I have to store and retrieve text files from a database table and > the size of each file is about 500k. Can someone give me an idea > on how to do this? You might want to have a look at this: http://sourceforge.net/projects/mysql-python Yo

Re: [Tutor] Some questions about my yen-USD.py

2006-09-07 Thread Andrei
on "amount <= 0" and inform the user that a number larger than 0 is required. Here's a modified version: def getAmount(currency): while True: useramount = raw_input('Amount: ').lower().strip() if useramount in 'qx': return

Re: [Tutor] i have a question

2006-03-12 Thread Andrei
"Hello %s" % username else: print "Incorrect name or password!" Other environments (e.g. wxPython, PyGame or web interfaces) offer different ways of achieving the same results, but I presume you're really new to Python and not yet messing around with those. Yours, Andr

Re: [Tutor] First program -- would like comments and criticisms

2006-02-18 Thread Andrei
put a webbased interface onto it, or subclass it and make a glossary which can also do multiple language translations, or use a different storage backend, etc.). -- Yours, Andrei = Mail address in header catches spam. Real contact

Re: [Tutor] Who called me?

2005-11-08 Thread Andrei
gt; def func(self): ... print self.__class__ >>> A.f = func >>> B.f = func >>> a, b = A(), B() >>> a.f(), b.f() -- Yours, Andrei = Mail address in header catches spam. Real contact info: ''.join([''.join(s) for s in zip( "[E

Re: [Tutor] Circular approach to a dictionary structure

2005-10-28 Thread Andrei
quires a single update, while the dictionary requires one new key-value pair and modifications in another two places in order to get it working correctly. -- Yours, Andrei = Mail address in header catches spam. Real contact info: ''.join([''.join(s) for s in

Re: [Tutor] Recursion and List Comprehensions

2005-10-28 Thread Andrei
mutation retList.append(word) else: # Return a list of all permutations using all characters [ retList.extend( [ word[pos] + item for item in permute3(word[0:pos]+word[pos+1:len(word)]) ] ) for pos in range(len(wor

Re: [Tutor] Global var problem

2005-10-28 Thread Andrei
s for input and the return statement to output any necessary modifications, e.g.: def p(inp): output = inp + 1 print output return output if __name__ == '__main__': x = 5 x = p(x) It would be even better with a decent function name of course :). More i

Re: [Tutor] Installing ActiveState Python vs2003

2005-09-29 Thread Andrei
ython, which seems to be what you got - one is a Python distro, the other is an extension of the VisualStudio IDE. Neither is a .Net implementation of Python, IronPython is (http://www.ironpython.com/). Yours, Andrei ___ Tutor maillist - Tutor@pyth

Re: [Tutor] Tutor Digest, Vol 19, Issue 82

2005-09-27 Thread Andrei
ng at the top of the digest: 'When replying, please edit your Subject line so it is more specific than "Re: Contents of Tutor digest..."' -- Yours, Andrei = Mail address in header catches spam. Real contact info: ''.join([''.join(s) for s in

Re: [Tutor] Exception handling - syntaxerror?!

2005-09-26 Thread Andrei
x27;, e.g. ">>> print 6; print 5" will work just fine. -- Yours, Andrei = Mail address in header catches spam. Real contact info: ''.join([''.join(s) for s in zip( "[EMAIL PROTECTED] pmfe!Pes ontuei ulc

Re: [Tutor] Exception handling - syntaxerror?!

2005-09-25 Thread Andrei
important difference. You should terminate the try-except block (confirm with extra ENTER) before doing more stuff. -- Yours, Andrei = Mail address in header catches spam. Real contact info: ''.join([''.join(s) for s in zip( "[EMAIL PROTECTED] pmfe!Pes ontuei ulcp

Re: [Tutor] creating strings

2005-09-25 Thread Andrei
h of if-statements. if g is between X1 and Y1: result is Z1 else if g is between X2 and Y2: result is Z2 else if ... -- Yours, Andrei = Mail address in header catches spam. Real contact info: ''.join([''.join(s) for s in zip( "[EMAIL PROTECTED] pmfe!Pes ontuei

Re: [Tutor] Error checking - very basic question

2005-09-25 Thread Andrei
> I can't see a simple way around it (wood for the trees) How about using a "while True" loop that you break out of only when a correct value has been identified: while True: dau_version = raw_input('blabla') if dau_version in ("2.8",

Re: [Tutor] Remaking Vim in Python (was Python Editors)

2005-09-23 Thread Andrei
ave an editor in which to be productive, it's probably better to invest some time in learning to use one of the existing options. Whether it's Spe, Scite, Komodo, Vim, Emacs or whatever else suits you, is not very relevant. -- Yours, Andrei = Mail address in header catches sp

Re: [Tutor] Python DB

2005-09-22 Thread Andrei
looking up treatments/illnesses for a given patient (with the patient being the key in the database) or if the number of patients is quite low (hundreds). If however an important use is to do other types of searches too (e.g. find all patients with an age above X who use a drug Y) and you ha

Re: [Tutor] Strange "snippets" in Learning Python, 2nd ed.

2005-08-20 Thread Andrei
sition, swallows and just about anything else that seems weird can usually be tracked down to that same source. -- Yours, Andrei = Mail address in header catches spam. Real contact info (decode with rot13): [EMAIL PROTECTED] Fcnz-serr! Cyrnfr qb abg hfr va choyvp cbfgf. V ernq gur yvfg, fb

Re: [Tutor] Searching Sorted Lists

2005-08-20 Thread Andrei
n: http://en.wikipedia.org/wiki/Binary_search Yours, Andrei = Mail address in header catches spam. Real contact info (decode with rot13): [EMAIL PROTECTED] Fcnz-serr! Cyrnfr qb abg hfr va choyvp cbfgf. V ernq gur yvfg, fb gurer'f ab arrq gb PP. ___

Re: [Tutor] My first recursive function...

2005-07-28 Thread Andrei
if the function finds it has called itself too many times - helps against infinite recursion too. >>> def a(i): ... i += 1 ... if i < 500: ... a(i) >>> a(0) If you try the function above without the if condition, it will generate a Runt

Re: [Tutor] samples

2005-06-23 Thread Andrei
e of loading all kinds of simple minigames. I don't know how far it is by now, but if you look in the pygame mailing list archives you should be able to find it. Yours, Andrei ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Planning a program with algorithm?

2005-05-31 Thread Andrei
ly in the directions which could be foreseen beforehand). Going from design-in-head straight to production code doesn't (at least for me) lead to the best of results in those respects, even though the code may work. Yours, Andrei ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Planning a program with algorithm?

2005-05-30 Thread Andrei
omething similar, this code would still not be quite high level, because shuffling the source, taking a slice and such are not built into those languages. In fact, in those languages you'd most likely choose a different approach at this level. Yours, Andrei _

Re: [Tutor] Planning a program with algorithm?

2005-05-30 Thread Andrei
y get more comments, while easier portions get fewer comments - just as it should be. Yours, Andrei ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Planning a program with algorithm?

2005-05-30 Thread Andrei
all games exit If you go into more detail, you'll end up writing a long version of the Python code, which kind of defeats the purpose of pseudocode. > Any useful advice for algorithm would be appreciated. It's more important (at least for larger progams) to think about good design in

Re: [Tutor] python problem

2005-05-26 Thread Andrei
couldn't convert to integer print 'Not a number' choice = 5 Yours, Andrei ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Expression order problem

2005-05-26 Thread Andrei
t;> test5.var() Traceback (most recent call last): File "", line 1, in ? File "", line 4, in var NameError: global name 'dummy' is not defined >>> dummy = 234 >>> test5.var() 234 >>> test5().var() 234 Which soultion is right, depends on your needs. I'm tempted to say (3) is the best one, unless you really need that to be a class attribute. Tip: http://zephyrfalcon.org/labs/python_pitfalls.html Yours, Andrei ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] While loop exercise

2005-05-22 Thread Andrei
or 2-person rooms and applies a discount if the reservation is on a day between monday and thursday. Yours, Andrei ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Password

2005-05-18 Thread Andrei
be decrypted without the password, even if the source code is available. -- Yours, Andrei = Real contact info (decode with rot13): [EMAIL PROTECTED] Fcnz-serr! Cyrnfr qb abg hfr va choyvp cbfgf. V ernq gur yvfg, fb gurer'f ab arrq gb PP. __

Re: [Tutor] I know you will hate this but...

2005-05-18 Thread Andrei
when a specific revision is requested. Sure you > hope it's the same as it was in the beginning but there's always a > chance for error. Yep. But the fact that only the indentation changed, sounds fishy. I'd rather expect editor settings to be at fault than the VCS. If you

Re: [Tutor] YATENJoe

2005-05-17 Thread Andrei
at "How to think like a computer scientist in Python" (http://www.ibiblio.org/obp/thinkCSpy/). Chapters 8 and 10 discuss Lists and Dictionaries http://www.ibiblio.org/obp/thinkCSpy/chap08.htm http://www.ibiblio.org/obp/thinkCSpy/chap10.htm , but I'd recommend you rea

Re: [Tutor] I know you will hate this but...

2005-05-17 Thread Andrei
should go around modifying code on its own in *any* way, even if it's spaces. Although, now that I think about it, a VCS might have an option of ignoring leading/trailing whitespace when doing diffs, such an option could bite when merging Python code. Yours, Andrei __

Re: [Tutor] Opinions about this GIS script

2005-05-17 Thread Andrei
7;,indexfile.read(4))[0]" and similar lines. A file class which would wrap this stuff and offer a nice interface with methods like ReadInt, ReadDouble would clear it up a bit. - "Private function" in the comment of __newdemo. I'd remove it, since the double underscore already documents this. Yours, Andrei ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] YATENJoe

2005-05-17 Thread Andrei
learn a bit more about Python's facilities before embarking on an ambitious project :) - you won't get very far without knowing how to use lists and dictionaries. Yours, Andrei ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Python Resources

2005-05-13 Thread Andrei
o this mailing list and ask questions (though I do caution > them not to submit their homework simply to get a solution). I think people reading a magazine called "IT Pro" should be aware of such basic etiquette :). -- Yours, Andrei = Real contact info (decode with rot13)

Re: [Tutor] dicts&lists vs objects

2005-05-12 Thread Andrei
ut to have some benefits (it's possible to mix OO and procedural code). If a project runs into thousands of lines of code, it virtually always makes sense to bring OO into the picture. Yours, Andrei ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Psyco (Joseph Quigley)

2005-05-04 Thread Andrei
than regular Python, it is still much > slower than C. Except in some amusing cases: http://mail.python.org/pipermail/python-list/2004-April/215272.html -- Yours, Andrei = Real contact info (decode with rot13): [EMAIL PROTECTED] Fcnz-serr! Cyrnfr qb abg hfr va choyvp cbfgf. V ernq gu

Re: [Tutor] tokenize row numbering

2005-05-02 Thread Andrei
above shows that numbering begins at 0, with the fourth line having number 3. So either I misunderstand the question, or the snippet is confusing. That being said, I can imagine counting lines from 1 because programming editors also tend to count from 1 instead of 0 and this way it

[Tutor] Re: CLS? (Joseph Quigley)

2005-04-22 Thread Andrei
ce for your application :). Command line apps which wipe out the command line history are bad. You might prefer making a GUI or a web application instead. -- Yours, Andrei = Real contact info (decode with rot13): [EMAIL PROTECTED] Fcnz-serr! Cyrnfr qb abg hfr va choyvp cbfgf. V ernq gur yv

[Tutor] Re: Installation Routines (Joseph Quigley) (Jay Loden)

2005-04-22 Thread Andrei
Joseph Quigley wrote on Fri, 22 Apr 2005 13:45:05 -0600: > Interesting. So several distros use rpms? I though only red hat used 'em. Yeah, including some major ones like Mandrake and Suse. -- Yours, Andrei = Real contact info (decode with rot13): [EMAIL PROTECTED] Fcnz-serr! C

[Tutor] Re: How to obfuscate a database password. (fwd)

2005-04-19 Thread Andrei
g else - though more obsfucation != more security). The effect this will have in stopping a determined person will be pretty much zero, but at least it's not out there in the open and a simple text search won't cause it to just show up. Yours, Andrei _

[Tutor] Re: snippets helps

2005-04-18 Thread Andrei
eful to rise to the top of > the examples? It would indeed, if someone implemented it :). > would get used or not. Perhaps the personal feedback of the tutor list > is more effective. OTOH, finding it yourself is faster than waiting for a reply. Yours, Andrei ___

[Tutor] Re: Installation Routines (Joseph Quigley)

2005-04-18 Thread Andrei
Tkinter wrapper) it would be even absolutely trivial (show a standard directory selection dialog, then copy the stuff - 5 lines of code or so). It would be cross-platform too. Yours, Andrei ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] Re: How can I avoid cut'n'paste in this case?

2005-04-16 Thread Andrei
> always thought it a bad smell. It does indeed smell of a maintenance nightmare waiting to happen :). The bad part is that it tends to get progressively worse. Imagine also what would happen if you'd get even more of those similar modules. Yours, Andrei ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] Re: newbie intro to pickle

2005-04-16 Thread Andrei
ary and mistakes might lead to breakage) It's quite obvious though that no method is good enough if you attach any kind of value to high scores, by e.g. posting the highest scores on your webpage. Yours, Andrei ___ Tutor maillist - Tutor@python

[Tutor] Re: exceptions

2005-04-16 Thread Andrei
erything goes well, you'll get a NameError if you try to print it. Also if it does exist, it will need to be reset before the try-except, otherwise afterwards you won't know whether its value comes from the last try-except or from some time in the past. On a sidenote: recommended Python

[Tutor] Re: newbie intro to pickle

2005-04-16 Thread Andrei
> mydb = bsddb.btopen('game.db') >>> pickle.loads(mydb['lastplayer']) 'John Doe' This is not useful for small amounts of data like the highscores list, but if you have more data (e.g. level data, dialog texts) and you need quick access to it without having to keep everything in memory all the time, bsddb is a comfortable option. Yours, Andrei ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] Re: high score lists

2005-04-14 Thread Andrei
en then it's still easier to keep them in a list of tuples, because it's easier to do manipulations like "remove the lowest score" when you insert a higher one. Yours, Andrei ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] Re: Recursion....what are the best situations to use it?

2005-04-14 Thread Andrei
ith certain connections between them (if there aren't too many points, otherwise you'll hit a recursion depth limit or a stack overflow). Or for a menu navigation system, where a showmenu() routine calls itself to display submenus. Yours, Andrei ___

[Tutor] Re: Craps, eternal loop (Joseph Q.)

2005-04-14 Thread Andrei
ke it a global variable and only initialize it at the start of the program). Yours, Andrei ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] Re: (no subject)

2005-04-14 Thread Andrei
t 4 letters, type i[-4:]. Yours, Andrei ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] Re: when to use properties?

2005-04-13 Thread Andrei
, but from that point on, it's no longer your responsibility to protect them from themselves. Python works on the assumption that programmers are responsible adults :). Yours, Andrei ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] Re: help (fwd)

2005-04-13 Thread Andrei
a plain text generic editor, save the program and double-click on it in Explorer (if you're on Windows) or launch it by typing at the command line: python myscript.py Yours, Andrei ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] Re: New to programming question

2005-04-13 Thread Andrei
t does! However, a different test reveals this: >>> d = {4:0, 5:0, 1:0} >>> d.keys() [1, 4, 5] Aha! So it sorts the keys (both tests support this conclusion). Or does it? >>> d = {4:0, -1:0, 5:0} >>> d.keys() [4, 5, -1] Nope, not sorted, not ordered - exactly as the Python specification states, dictionaries are unordered. Yours, Andrei ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] Re: when to use properties?

2005-04-12 Thread Andrei
y and add the appropriate methods, so that the interface remains the same. Yours, Andrei ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] Re: Python starting books (fwd)

2005-04-12 Thread Andrei
not Python-specific: if they convey their ideas clearly, you can implement such things on your own. Yours, Andrei ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] Re: sorting a list of dictionaries

2005-04-12 Thread Andrei
s context just a different way of defining a function. The net result is a comparison function which is called by the sort() method in order to determine which of two dictionaries is 'smaller' or 'larger'. Yours, Andrei ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] Re: Sorting of files based on filesize

2005-04-11 Thread Andrei
erfectly, even though initial random file distributions give 240+ discs), but I haven't checked the results very thoroughly. It might be doing something really stupid. It's also reasonably fast (1000 generations of 1000 individuals each is feasible for example, but not necessarily

[Tutor] Re: import.... (Joseph Q.)

2005-04-10 Thread Andrei
a more detailed description it's hard to determine. I would say it's perpahs a bit unusual if you do indeed have two modules with the same interface but different behavior. Yours, Andrei ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] Re: import.... (Joseph Q.)

2005-04-09 Thread Andrei
7;t provide? -- Yours, Andrei = Real contact info (decode with rot13): [EMAIL PROTECTED] Fcnz-serr! Cyrnfr qb abg hfr va choyvp cbfgf. V ernq gur yvfg, fb gurer'f ab arrq gb PP. ___ Tutor maillist - Tutor@python.org http://mail.python.org/

[Tutor] Re: Help with classes (Joseph Q.)

2005-04-09 Thread Andrei
ink of an address book (where you use names as keys and addresses as values), a menu system (where certain user input is mapped to a certain function), a cache system (where results of certain time-consuming operations are saved in case the user asks for the same operation again) and there are man

[Tutor] Re: Class - superclass

2005-04-08 Thread Andrei
e the fact that __init__ is indeed inherited: >>> class C(A): ... pass >>> c = C() # inherited __init__ (A.__init__) is called >>> c.a 13 -- Yours, Andrei = Real contact info (decode with rot13): [EMAIL PROTECTED] Fcnz-serr! Cyrnfr qb abg hfr va choyvp cbfgf. V er

[Tutor] Re: Help with classes

2005-04-08 Thread Andrei
pick up excalibur even though conan already has it.) You can see that conan and donan are both players (Player objects), but each of them has his own name, inventory and strength. Even if conan's inventory is full, donan can still pick up new things. Yours, Andrei ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] Re: Help with classes

2005-04-08 Thread Andrei
Bob Gailer alum.rpi.edu> writes: > At 12:22 PM 4/7/2005, Andrei wrote: > >Kevin gmail.com> writes: > > > > > I am fooling around with classes and I was trying to create a very > > > small one player text adventure. I made a class called commands here &g

[Tutor] Re: Help with classes

2005-04-07 Thread Andrei
he player is in plus the connected rooms), an Item class (with subclasses for different types of items, where different implementations of e.g. PickUp methods would determine if the player could pick up a pencil or a skyscraper), etc. Yours, Andrei

  1   2   >