Re: [Tutor] Iterating a dict with an iteration counter? How would *you* do it?

2013-02-04 Thread Modulok
Hmm.. no kidding. Well, at least I knew I was over-complicating it. Cheers! -Modulok- On 2/4/13, Dave Angel wrote: > On 02/04/2013 12:13 PM, Modulok wrote: >> List, >> >> Simple question: Is there a common pattern for iterating a dict, but also >> providing acc

[Tutor] Iterating a dict with an iteration counter? How would *you* do it?

2013-02-04 Thread Modulok
t;} for i,k,v in zip(range(len(data)), data.keys(), data.values()): print("i: %s, k: %s, v: %s" % (i,k,v)) How would you do it? -Modulok- ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] optparse.OptionParser options in alphabetical order in help display

2012-12-18 Thread Modulok
s probably the best place to check it out. -Modulok- On 12/18/12, rail shafigulin wrote: > Does anybody know if there is a way to make --help option to display > options in alphabetical order? Right now it displays options in the order I > added them. I'm usi

Re: [Tutor] code to generate my own text captchas

2012-10-24 Thread Modulok
ou might look into writing a shell script or even python script wrapped around ImageMagick. -Modulok- ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Passing arguments to & running a python script on a remote machine from a python script on local machine .

2012-09-20 Thread Modulok
) > cmd = 'python test.py %s %s %s' % args > > Notice there are no longer quotes around each %s in cmd. Python 3.3 > will have shlex.quote: > > http://docs.python.org/dev/library/shlex.html#shlex.quote Why is ``pipes.quote`` undocumented? It's useful. -Modulok-

Re: [Tutor] [Semi-OT] Yes or no on using a Graphical IDE?

2012-09-15 Thread Modulok
ls like ipython can make up for some of that, but even so that's not something I generally write code in. Perhaps others have more insight. -Modulok- ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

[Tutor] Does anyone use UML?

2012-09-13 Thread Modulok
List, Does anyone use UML (Unified Modeling Language) with python? If so, what tools do you use? Is it worth the added effort? -Modulok- ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org

[Tutor] Genetic module recommendations?

2012-08-18 Thread Modulok
to the point of haulting evolution. On the other hand, I don't want so much entropy that it's reduce to a random search. Before I write my own, I thought I'd ask to see if there was a third party, de-facto standard Python genetic module. Or at least one that is highly recommen

Re: [Tutor] specifying my "default" python installation

2012-08-17 Thread Modulok
python with the version you choose, but it will work. Finally, if you want to get carried away, you can install a virtual python as mentioned. For even more options, you might subscribe to questi...@freebsd.org ;) -Modulok- ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Confusion with Python, Bash and Command Prompt

2012-08-09 Thread Modulok
der reading shebang lines. The file would be passed to the python interpretter, assuming a correct shebang.) You are right in your assumption; It does not apply to Windows. The tutorial is incorrect. -Modulok- ___ Tutor maillist - Tutor@python.org To unsubscri

Re: [Tutor] While learning Py: To IDE or not to IDE?

2012-05-20 Thread Modulok
lable. You can also ooze right into system administration without much effort. But again, that's just me :p -Modulok- ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] TypeError: 'int' object is not callable

2012-05-16 Thread Modulok
he call to the function 'factors'. You get the error because you assigned factors an integer and you cannot 'call' an integer. The easiest solution is to use another name for the variable 'factors' instead. -Modulok- ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Is there space a between "#!" and "/usr/bin/env python" ?

2012-05-01 Thread Modulok
cursive /etc/rc* | wc And this respectively:: grep --ignore-case --regex '^#!/.*' --recursive /etc/rc* | wc On my FreeBSD server all files shipped with the OS don't uses spaces. They're just '#!/bin/sh'. However, some of my own scripts

Re: [Tutor] How to have the name of a function inside the code of this function?

2012-04-06 Thread Modulok
ame_info.function) foo() That said, there's probably a better way to solve whatever bigger problem you're trying solve. -Modulok- ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] breeds of Python .....

2012-03-31 Thread Modulok
division Now in 2.x, just like 3.x this will raise an exception: print "foo" #<-- Now fails in 2.x print("foo")#<-- Works. -Modulok- ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Syntax error help

2012-03-30 Thread Modulok
s well: print ' the side length is' sidelength ** 2 The print statement only takes a single argument, or multiple arguments *if* they are comma separated, e.g: print ' the side length is', sidelength ** 2 However, this whole thing would be better written using string substitution:: print ' the side length is %s' % (sidelength ** 2) This is also incorrect: Areamenu() Your code defines a function named 'areamenu', not one named 'Areamenu'. Remember, python is case sEnsItiVe. e.g: Foo() and foo() are different. Good luck! -Modulok- ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] tabbed output

2012-02-12 Thread Modulok
ment), As a final note, if 'CheckNames' is a function and not a method, it should be all lowercase, or use_underscores rather than camelCase. This is not enforced by python, but is kind of the de-facto standard. Read more about the format method here: http://docs.python.org/library/string.html#formatspec http://docs.python.org/library/string.html#formatstrings -Modulok- ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Python Database Scripting

2012-02-08 Thread Modulok
The closest thing you'll find will probably be the third party module 'sqlalchemy'. You can install it via easy_install or pip. If that doesn't meet your needs I'm not sure what else would. (But would love to hear about it.) -Modulok- On 2/8/12, Brad Hudson wro

Re: [Tutor] decimal precision in python

2012-02-06 Thread Modulok
For money, you should probably use the builtin module 'decimal' instead: http://docs.python.org/library/decimal.html There's also the third party module 'mpmath' which provides arbitrary precision floating point arithmetic. http://mpmath.googlecode.com/svn/trunk/doc/b

Re: [Tutor] Error Checking/Defensive Programming

2012-01-25 Thread Modulok
print("You loose!") The rule doesn't always hold true, but it's a general guideline. Hope that helps. -Modulok- On 1/25/12, Michael Lewis wrote: > Hi everyone, > > I am new to python and have a noob question. > > Is it generally better to use try/except/else

Re: [Tutor] Simple Question (I Hope)

2012-01-14 Thread Modulok
On 1/14/12, Chris Kavanagh wrote: > I was looking at this code from the Python Docs > (http://docs.python.org/library/email-examples.html), trying to learn > how to send email from a Pyhton script. Anyways, part of this code > confused me. Here's the script: > > 1 # Import smtplib for the actual s

Re: [Tutor] Your thoughts on designing python code for unit testing?

2012-01-04 Thread Modulok
you can. Everyone has a little different process, but that's how I do it. -Modulok- On 1/4/12, brian arb wrote: > What are some of the strategies for designing code to be unit tested? > ___ Tutor maillist - Tutor@python.org To unsubscribe

Re: [Tutor] sqlite3: turning on foreign key support thru python

2011-12-16 Thread Modulok
thing like this when foreign keys are turned on:: (1,) Or this when they're turned off:: (0,) Hope that helps. -Modulok- On 12/16/11, Monte Milanuk wrote: > I'm setting up an sqlite3 database to use as a base for some programming > stuff I > want to work on. Currently

Re: [Tutor] where python is used in real world

2011-12-04 Thread Modulok
>> 2. If one wants to make a commercial software using python, how can he >> hide the code? While it's a valid question, it's fun to imagine it in the physical world: "We need to permanently weld the engine compartment closed so that no one can steal o

Re: [Tutor] File vs. Database (possible off topic)

2011-11-21 Thread Modulok
s for you. The most popular module is probably sqlalchemy. It talks to postgresql, mysql and a few others. It's a good idea to get used to sqlite and general SQL concepts before you jump into sqlalchemy! Good luck! -Modulok- ___ Tutor maillist -

Re: [Tutor] methods vs. functions

2011-08-22 Thread Modulok
On 8/22/11, Prasad, Ramit wrote: > Steven D'Aprano wrote: >>(Methods are very similar to functions. At the most basic level, we can >>pretend that a method is just a function that comes stuck to something >>else. Don't worry about methods for now.) > > Can someone please explain the difference bet

Re: [Tutor] floats

2011-06-06 Thread Modulok
>> Can someone till me how to get a two decimal precision every time? print "%.2f" % (500/1000.0) # or... result = 500 / 1000.0 print "%.2f" % result Using 'new' style string formatting works too: print "{0:.2f}".format(500/

Re: [Tutor] Clunky Password maker

2011-05-25 Thread Modulok
passwd[3] > print "" > print "".join(map(str, passwd)), " is your new password. \n" > [/code] > > [output] >>>> > Enter 1 to run a MD5hash on your password > Enter 2 to run a SHA1 hash on your password > Ente

Re: [Tutor] Titles from a web page

2011-05-04 Thread Modulok
You might look into the third party module, 'BeautifulSoup'. It's designed to help you interrogate markup (even poor markup), extracting nuggets of data based on various criteria. -Modulok- On 5/4/11, louis leichtnam wrote: > Hello Everyone, > > I'm trying to wr

Re: [Tutor] How to solve this problem in python?

2011-04-24 Thread Modulok
t; generally doesn't.) -Modulok- On 4/24/11, Ratna Banjara wrote: > Write a function named countRepresentations that returns the number > of ways that an amount of money in rupees can be represented as rupee > notes. For this problem we only use rupee notes in denominations o

Re: [Tutor] Metaclass confusion...

2011-04-20 Thread Modulok
nk you! You've solved my problem and broadened my understanding :) Excellent examples as well. Love the class name too. -Modulok- ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

[Tutor] Metaclass confusion...

2011-04-19 Thread Modulok
r(Foo, 'serial')#<-- I was really expecting this to be True. I could add the attribute in the definition or a decorator, but the point was learning to use (albeit abuse) metaclasses. Anyway, if anyone could take a look I'd be grateful. Thanks! -Modulok- __

Re: [Tutor] String formatting question.

2011-03-29 Thread Modulok
For simple strings I use the "%s" % foo version, for more complex stuff I use the .format() method. I find it easier to control spacing and alignments with the .format() method, but that's just me. -Modulok- On 3/29/11, Blockheads Oi Oi wrote: > On 29/03/2011 20:41, Prasad,

Re: [Tutor] time taken to execute certain task

2011-03-16 Thread Modulok
psed = ", end - start, "seconds" > > thanks > tcl > Also look into the builtin module 'timeit' if you're trying to benchmark things. -Modulok- ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Help - want to display a number with two decimal places

2011-03-04 Thread Modulok
hase Price", purchasePrice) # First prints the first argument (the 0th index) to 'format(), # left aligned '<', and 18 characters wide, whitespace padded. # Then prints the second argument, (the 1st index) right aligned, # also 18 characters wide, but the second argument is specified to # be a float 'f', that has a precision of 2 decimal places, '.2'. -Modulok- ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

[Tutor] Shared web host and setting the python environment...

2011-03-04 Thread Modulok
complish this? (Aside from a new hosting company or a virtual private server.) Any suggestions appreciated. Thanks! -Modulok- ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] File transfer HTTP -> SFTP

2011-03-01 Thread Modulok
he above command with python via the subprocess module if needed. -Modulok- On 3/1/11, Emanuel Lauria wrote: > Sorry if im annoying, but I think this is a better question than my previous > one of today. > > I have some Images in an HTTP Server that I need to transfer to an SFTP >

Re: [Tutor] Generator expressions...

2011-02-27 Thread Modulok
. Why? >> >> except KeyboardInterrupt: >>gen.close() >>fd.close() >>print "\nBye!" >> > Check out the generator expression. What are you iterating over? How > long is the string returned by the read? I knew it was s

[Tutor] Generator expressions...

2011-02-27 Thread Modulok
ose() print "\nBye!" ## End code I've got to be missing something obvious. -Modulok- ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] accessing another system's environment

2011-02-26 Thread Modulok
On 2/26/11, Modulok wrote: ... > The server then replies with any variables that the client needs to > set and their values. You could do this with a python script running > on a server sending ajax responses. (There's an ajax module in the > standard library.) ... Sorry, I mean

Re: [Tutor] accessing another system's environment

2011-02-26 Thread Modulok
I'm coming into this thread late so I might be off the mark here, but it seems like you're going about it backwards: Instead of trying to reach in and modify a user's environment, which is highly variable and process dependent, why not just wrap the software they're running? Have a python script w

Re: [Tutor] Try except really better than if?

2011-01-09 Thread Modulok
and use an exception as accident insurance. If it will usually fail, check it with an if statement first. -Modulok- ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

[Tutor] Weighted Random Choice - Anyone have an efficient algorithm?

2010-12-22 Thread Modulok
.append(i) if debug: print "flattened: ", flattened rnd = random.randint(0, (len(flattened) - 1)) return flattened[rnd] # Not test it: print wrandom([5, 20, 75]) print wrandom([5, 20, 75]) print wrandom([5, 20, 75]) ### End Code Example ### It works and is easy enough

[Tutor] unit testing - Separate methods or group tests together?

2010-12-17 Thread Modulok
List, When you create unit tests, do you group tests for a given function together into one unit test method, or do you prefer to have separate test methods for every assert statement? Thanks! -Modulok- ___ Tutor maillist - Tutor@python.org To

Re: [Tutor] Writing to the terminal?

2010-12-12 Thread Modulok
List, Thanks! I think I got it working now with the help of some suggestions :-) For more complex stuff, (think blue screens with little white boxes you press spacebar to activate. Kind of like an OS installer) I would look into the `curses` module in the standard library? Thanks! -Modulok

[Tutor] Writing to the terminal?

2010-12-10 Thread Modulok
evious number... I just want to change it in place. (If that makes any sense?) Think of console based progress counters in programs like fetch or wget, or lame. How do you do this in Python? -Modulok- ___ Tutor maillist - Tutor@python.org To unsubscribe

Re: [Tutor] Calling Program within Program

2010-12-09 Thread Modulok
Patty, I didn't read through your code, but to call an external program see the 'subprocess' module in the standard library: http://docs.python.org/library/subprocess.html -Modulok- On 12/9/10, pa...@cruzio.com wrote: > > Hello: > > I would like to know how to c

Re: [Tutor] True Random Numbers

2010-11-03 Thread Modulok
random foo = random.SystemRandom() # Uses /dev/urandom or Windows CryptGenRandom # Print 10 random numbers: for i in range(10): foo.random() What are you using the random numbers for? -Modulok- ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] unittest testing order...

2010-09-27 Thread Modulok
On 9/27/10, Steven D'Aprano wrote: > On Tue, 28 Sep 2010 04:03:17 am Modulok wrote: >> List, >> >> When using the unittest module, tests are run in alphanumeric order. >> What's the suggested way of specifying a test order? > > There isn't one.

[Tutor] unittest testing order...

2010-09-27 Thread Modulok
List, When using the unittest module, tests are run in alphanumeric order. What's the suggested way of specifying a test order? Any code examples would be great! Thanks -Modulok- ___ Tutor maillist - Tutor@python.org To unsubscribe or c

Re: [Tutor] quick speed question

2010-09-16 Thread Modulok
at it. (This list is great for that!) If that too fails, start think about writing a few critical bits in C, but only as a last resort. "We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil" -Donald knuth- -Modulok- On 9

Re: [Tutor] Advice on math

2010-06-27 Thread Modulok
ou have basic understanding of > maths. Not to hijack the thread, but that's awesome! Only when you solve the problems and then read the forum thread, do you realize how crude your own solutions are, compared to some very clever fellows. Far better than a crossword to keep things stimulated.

[Tutor] Data exchange formats...

2010-06-20 Thread Modulok
List, What's the best format to send data across the wire between processes? I have some simple 'insensitive' data I need to send from a client, to a server via a TCP socket. Things like 'count = 10, name="foo"' and so forth. Basic values. I would use something like the 'pickle' module to pack th

[Tutor] Trouble with sockets...

2010-06-17 Thread Modulok
List, I'm new to sockets and having trouble. I tried to write a simple client/server program (see code below). The client would send a string to the server. The server would echo that back to the client. PROBLEM: I can send data to the server, and get data back, but only for the first call to the

Re: [Tutor] help

2010-06-17 Thread Modulok
Solution: width times height. On 6/17/10, KB SU wrote: > help > ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Making pretty web pages from python code examples?

2010-04-14 Thread Modulok
es/features for pulling the docstrings from your python > modules. Much easier than building your own. Thanks! Looks like just what I'm after. -Modulok- ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://m

[Tutor] Making pretty web pages from python code examples?

2010-04-13 Thread Modulok
parse the files was a rut. Thanks. -Modulok- ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Introduction to modelling with Python

2010-03-28 Thread Modulok
a command interface to automate things. See the developer's documentation for whatever software you're using. What kind of modeling? -Modulok- On 3/27/10, AG wrote: > Hi List > > I apologise in advance for the vagueness of this query, but I am looking > for a decent modern introd

Re: [Tutor] Bowing out

2010-03-03 Thread Modulok
ne who contributes questions and answers. I learned a > lot from my participation here. Kent, I'm a relative newcomer, but even so, I benefited from you. Thanks for giving what you could! Best of luck with your new endeavors. Hope to see you check

Re: [Tutor] Encryption

2010-02-22 Thread Modulok
f pycrypto. There are probably other AES implementations out there as well. However, the only FIPS certified library I know of is openssl. -Modulok- On 2/22/10, Shashwat Anand wrote: > how about using base64? base64.encodestring(s) will do. > > > > On Tue, Feb 23, 2010 at 2:30 AM, Wa

Re: [Tutor] adding more text to a file

2010-01-18 Thread Modulok
ame: ") age = raw_input("What is the age: ") out_file.write("name:%s\nage: %s\n\n" (name, age)) # We'll never get this far unless we figure out a way to stop the loop! out_file.close() Keep at it and best of luck! -Modulok-

Re: [Tutor] How to create memory backed file?

2009-12-27 Thread Modulok
Kent, Thanks! I think that'll do it. I don't know what this list would do without you! -Modulok- On 12/27/09, Kent Johnson wrote: > On Sun, Dec 27, 2009 at 3:36 AM, Modulok wrote: >> List, >> >> How do I create a file which exists only in memory? (Think diskless

[Tutor] How to create memory backed file?

2009-12-27 Thread Modulok
error: Traceback (most recent call last): File "", line 1, in AttributeError: fileno I'm using Python 2.5, so I cannot use that slick 'SpooledTemporaryFile' method of the 'tempfile' module. The 'cat' is just a simple Unix system c

Re: [Tutor] More on unit testing - tests for external data...

2009-12-10 Thread Modulok
t's been frustrating as hell. Case studies/tutorials anyone? Thanks! -Modulok- On 12/10/09, spir wrote: > Wayne Werner dixit: > >> On Wed, Dec 9, 2009 at 6:15 PM, Alan Gauld >> wrote: >> >> > >> > Remember, in testing you are not trying to prove

[Tutor] More on unit testing - tests for external data...

2009-12-09 Thread Modulok
y? If anyone could point to a few examples of such usage, that would be great! Thanks! -Modulok- ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] python time

2009-11-27 Thread Modulok
urrent time in seconds since the Epoch. >> Fractions of a second may be present if the system clock provides >> them. >> >> >> >>> time.time() >> 1259288538.576565 >> >> Right? >> -Modulok- > > For sure, but this wasn't

Re: [Tutor] python time

2009-11-26 Thread Modulok
system clock provides them. >>> time.time() 1259288538.576565 Right? -Modulok- On 11/26/09, Kent Johnson wrote: > On Wed, Nov 25, 2009 at 11:11 AM, spir wrote: >> Hello, >> >> How does python get the time in microseconds? (In other words, how would I >> get

Re: [Tutor] Fwd: Help on finding the 1000th prime

2009-11-16 Thread Modulok
Also watch things like letter case on stuff like 'Print' and 'While', they should instead be 'print' and 'while', (all lowercase). -Modulok- On 11/16/09, bob gailer wrote: > >> Here is the code that doesn't work. >> > > Thank

[Tutor] Do you use unit testing?

2009-11-16 Thread Modulok
different angles on the matter, from the Python community. -Modulok- ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

[Tutor] OT: Writing code while tired, counterproductive?

2009-11-14 Thread Modulok
ines. *grumble* Just wondering if this is a common occurrence among the masses. Anyone? -Modulok- ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] How to call a method with a print statement?

2009-11-13 Thread Modulok
List, __repr__() is exactly what I was looking for :) You guys rock! Thank you. -Modulok- On 11/12/09, Dave Angel wrote: > > > Kent Johnson wrote: >> On Thu, Nov 12, 2009 at 6:35 AM, Luke Paireepinart >> wrote: >> >>> On Thu, Nov 12, 2009 at 5:29 AM, Je

[Tutor] How to call a method with a print statement?

2009-11-12 Thread Modulok
nt "hello world!" # Now use it: bar = Foo() print bar hello world! #<-- Magic! If any of this makes sense, any pointers would be great! -Modulok- ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: ht

Re: [Tutor] Evaluating a string expression

2009-11-05 Thread Modulok
. But in most situations executing code from an untrusted source is a *really* bad idea, even with precautions as those outlined in the example URL provided by one of the other responses. (http://effbot.org/zone/librarybook-core-eval.htm) Sorry for all the lecture. I'll shut up now. :p -Modulo

Re: [Tutor] why is os.path.walk so slow?

2009-11-04 Thread Modulok
o cut your coding project short, and it may not even be applicable, but have you looked into rsync? They kind of wrote the book on efficiency in regards to synchronization of files. Just a thought. -Modulok- ___ Tutor maillist - Tutor@python.org To unsu

Re: [Tutor] Stolen thread: Bottom folk vs. toppers was trouble using 2to3.py

2009-11-03 Thread Modulok
imply propose that the only requirement to communications here is > that replies and questions be well formulated, courteous, and reasonably > intelligent. Yup. -Modulok- ___ Tutor maillist - Tutor@python.org To unsubscribe or change su

Re: [Tutor] Generating unique ID

2009-10-28 Thread Modulok
be unique. It's just, "probably unique". It would look like this: >>> import time >>> time.time() 1256796357.661967 If it absolutely must be unique, use a database manager that can make that guarantee. Best of luck! -Modulok-

Re: [Tutor] How to load a dict into a dict subclass?

2009-10-28 Thread Modulok
gt; ### END CODE >> > You can use the built-in function for dictionaries called update. So > > >>> class Bar(dict): > >>> pass > > >>> foo = {'a':100, 'b':200, 'c': 300} > >>> myvar = Bar() >

[Tutor] How to load a dict into a dict subclass?

2009-10-27 Thread Modulok
rn value. myvar = Bar() # The hacky feeling part: for k,v in foo.items(): myvar[k] = v ### END CODE Obviously I can put the dict into an instance variable, but then methods like 'keys()' and such won't work. If that makes any sense... Thanks guys! -Modulok- ___