On Mon, Oct 5, 2009 at 2:24 PM, Nick Hird nrh...@gmail.com wrote:
What is the best version of python to start out with? I see some
discussions on the net about not going to 3.1 but staying with the 2.x
releases. But then i see that 3.1 is better if your just starting.
greetings nick!
On Fri, Oct 2, 2009 at 11:14 PM, Oxymoron moron@gmail.com wrote:
Hello,
On Sat, Oct 3, 2009 at 3:56 PM, Didar Hossain didar.hoss...@gmail.com
wrote:
homedir = os.environ.get('HOME')
if homedir:
print My home directory is %s % homedir
I do this in Perl -
my $home;
if ($home =
I would like to create a program which
should repeat a simply string several times with list number before.
Like 1. Wanna more. 2. Wanna more. ...
Suppose to a loop here repeating, say x times. Should it look like that:
y=Wanna more.
x=1
x=x+d:
d=100
print d+y
How to create a program
I need help writting a program.
1) Random string generation
2) no repeating letters
Can anyone help me,please? I am so confused. The only problem is I have to
use the code that is written there but add on to it.
import random
alphabet = abcdefghijklmnopqrstuvwxyz
myNewString =
for
On Sep 30, 4:58 am, lallous lall...@lgwm.org wrote:
Can anyone suggest a good book Python book for advancing from beginner level?
(I started with Learning Python 3rd ed)
From: James Matthews nyt...ail.com
Date: Wed Sep 30 18:47:58 CEST 2009
I like core python programming and dive into
I tried this:
win32net.NetUseDel(None, 1,{'local':'k:'})
but I got this error:
Traceback (most recent call last):
File test.py, line 33, in module
win32net.NetUseDel(None, 1,{'local':'k:'})
TypeError: an integer is required
You have the wrong sequence for NetUseDel(). Try:
Just think: 4 players left means that this is the semi final.
What a brilliant answer! It tells him how to do it if he just stops and
thinks but gives nothing away. I love it. :-)
i agree with alan on this. in fact, i can just picture the brackets in
my head already. :-)
another thing from
an expression is something ... that evaluates to *some* Python object
:
in contrast, a statement is something that has no intrinsic value
Umm.you just completely confused me. What does it do?
ok, now *i*'m the one confused... what does *what* do?
both expressions and
On Mon, Sep 21, 2009 at 2:06 PM, Wayne sri...@gmail.com wrote:
On Mon, Sep 21, 2009 at 4:00 PM, kreglet kreg...@gmail.com wrote:
I keep getting the following error and don't uderstand why:
Traceback (most recent call last):
File /home/kreglet/bin/test.py, line 15, in btnStatclick
-on labs will help hammer the concepts home.
Come join me, Wesley Chun, author of Prentice-Hall's bestseller Core
Python Programming, for a comprehensive course coming up this Fall in
beautiful Northern California to get up-to-speed with Python as
quickly and as in-depth as possible!
WHERE: near
-on labs will help hammer the concepts home.
Come join me, Wesley Chun, author of Prentice-Hall's bestseller Core
Python Programming, for a comprehensive course coming up this Fall in
beautiful Northern California to get up-to-speed with Python as
quickly and as in-depth as possible!
WHERE: near
hi Giorgio,
welcome to Python (whether directly or from GAE!) :-) my comments below.
with import i can import modules or single functions. And this is ok.
not quite true. regardless of whether you use import or from-import,
you're *always* importing (and loading) modules or packages in their
AP CS Courses (and Students) on the Decline, CSTA Survey Finds
This spring, the 2009 CSTA National Secondary Computer Science Survey
collected responses from some 1,100 high school Computer Science
teachers. The results: only 65 percent reported that their schools
offer introductory or pre-AP
On Wed, Aug 12, 2009 at 1:07 PM, David Kimdavidki...@gmail.com wrote:
Unfortunately I live on the East Coast, otherwise I'd definitely attend! I
am attracted to the declarative nature of reStructuredText, but I also
recognize that A LOT of people use Powerpoint and are comfortable with it.
Maybe you could break that up a bit? This is the tutor list, not a
one-liner competition!
rather than one-liners, we can try to create the most Pythonic solution.
below's my entry. :-)
myMac$ cat parafiles.py
#!/usr/bin/env python
from itertools import izip
from os.path import exists
On Thu, Jul 30, 2009 at 11:18 AM, Che Mpine...@hotmail.com wrote:
Did you actually look at what happens when you click that
link? (i.e. where you are brought to?).
Because upon viewing this I achieved enlightenment! :D
lucky you... i achieved recursion. :-)
in addition to the good advice from vince (watch out for greediness
regardless of what you're looking for) and bill (use raw strings...
regexes are one of their primary use cases!), another thing that may
help with the greediness issue are the character sets you're using
inside to match with.
for
could this be done in a more elegant fashion?
in addition to alan's obvious solution, if you wanted to roll your
own, you have a good start. my comments below.
def Unite(set1, set2): # evaluate 2 lists, join both into 1 new list
newList = []
for item in set1:
On Fri, Jul 24, 2009 at 11:40 PM, Chris Castilloctc...@gmail.com wrote:
Okay I really need help with the program I am writing. I've can't seem to
figure out what I need to do and have tried several different methods.
hi chris, and welcome to Python! the tutors here are very helpful to
those
On Fri, Jul 24, 2009 at 2:34 PM, Jesse Harrismrjes...@yahoo.com wrote:
for d in Decks.all(): #loop thru all available decks
self.response.out.write('OPTION'+d.name)
self.response.out.write('OPTION'+d.description)
self.response.out.write('/SELECT/div')
Thankyou sir it is working.but one more thing i want to ask that if my
file will have entries like:---
fileA and fileB
12 10
13 12
14
15
means if their no. of entries will not match then how to combine them(both
input files have more than one column).
this is up to
on a related note, there is a module called fileinput that doesn't do
what you (the OP) need for this particular problem, but it is one to
keep in mind for the future as there may be a situation for which it
is the right tool. it doesn't get a lot of buzz but can come in handy
-- for me, it was in
Maybe you could break that up a bit? This is the tutor list, not a
one-liner competition!
rather than one-liners, we can try to create the most Pythonic
solution. below's my entry. :-)
cheers,
-wesley
myMac$ cat parafiles.py
#!/usr/bin/env python
from itertools import izip
from os.path
On Wed, Jul 15, 2009 at 8:29 AM, Rich Lovelyroadier...@googlemail.com wrote:
2009/7/15 vince spicer vinces1...@gmail.com:
:
import re
:
values = re.split(\s+, line) # split values on spaces EX: ['47', '8',
That isn't what they're after at all.
Something more like
Can some one give, or point to some good examples of how @decorators
work, and __call__ (able) objects?
simple example of calling a class
class myKlass(object):
def __call__(self, *args, **kws):
print i was called
test = myKlass()
test()
i was called
close. the
Can you run for loops in while loops and if yes, why did my if condition not
break the loop?
I read that loops sort of have an order of precedence, does that have
anything to do with this problem?
todd,
welcome to Python! you're right in that your questions are related to
each other
The other day I needed to pack a dictionary, the value of each key was a
list. In the code I was packing the list and the dictionary at the same time.
First I tried something like this:
list = []
dict = {}
x = 1
dict['int'] = list.append(x)
The result was {'int': None}. Why is the
So how would you break out from this situation?
as i mentioned in my other msg, you need another break statement that
is *not* in another loop. in your case, not in the for-loop. you need
a break statement somewhere within your while block (again, that's not
in any other loop). IOW, it should be
I'm not sure if this is good practice, but I could assign a variable within
the while loop, that is assigned something that will then break the outer
loop.
while True:
breakout = True
do something
for i in items:
if i 10:
breakout = False
else:
luis,
thanks for the kind words... i am glad that i am able to help you with
developing your Python programming skills. you are indeed taking it
to the next level by adding more to the problem without me asking you
to. i think that's great!
i am a software engineer by profession, which doesn't
On Jul 7, 1:04 pm, kj no.em...@please.post wrote:
I'm having a hard time coming up with a reasonable way to explain
certain things to programming novices.
:
How do I explain to rank beginners (no programming experience at
all) why x and y remain unchanged above, but not z?
:
What do
Robert, Emile, Malcolm,
wow, you guys are making me blush while hijacking this thread!
people are gonna start thinking i paid you off somehow LOL! :-)
seriously, thanks for the kudos. since i'm a technical instructor,
i wrote it not only from the software engineer's perspective, but
also a
may have to signup for a free
account to see the video).
What is Python by CPP (Core Python Programming) by author Wesley Chun
http://www.safaribooksonline.com/Corporate/DownloadAndResources/webcasts.php
ah, i wasn't aware that they finished editing it and put it online.
thx for the pointer
On Sun, Jul 5, 2009 at 11:48 PM, Luis Galvancynicalairr...@gmail.com wrote:
Hello all, this is my first time using a mailing list, so I'm not sure if
I'm doing this right! Anyway, I have a wee bit of a problem. I've recently
completed watching a Youtube video series on Python 2.6 by
I'm having trouble finding good tutorials on creating standalone
executable
files for mac os x.. I've been looking at 'py2app', [...]
pete,
welcome to Python! in order for all to answer your question more
appropriately, you'll have to describe the problem in slightly more
detail.
what do
After all with Python 2.3 pre installed on MacOS X
Is Python 2.3 really the most recent version of Python distributed with
new Macs?
I think *new* Macs come with 2.5. My 2-year-old MacBook Pro has 2.3.
i got a new MBP from work about half a year ago with leopard 10.5.6
installed, and it came
n = colourless
o = colourless
n == o
True
n is o
True
p = green ideas
q = green ideas
p == q
True
p is q
False
Why the difference?
angus,
welcome to Python! you're definitely doing your homework when it comes
to trying to understand how Python manages its memory. with regards to
However, it seems that I can't put the function definition in a file
and import it because I can't find a way to refer to an object in the
main program file from within a module file. I understand that it's a
good thing to contol which namespaces are referenced by which code but
isn't there
On Mon, Jun 29, 2009 at 3:59 AM, Christian Wittscwi...@compuscan.co.za wrote:
l...@ithstech.com wrote:
Have I installed something incorrectly in Python 3.1 for Mac if I get a
syntax error on
print hello world
My Python 2.3.5 executes this just fine. What have I missed?
Please take a
from showmodule import show
then everything else will work.
I don't think so. The exec in show() must be run in the namespace in
which the symbols being displayed are defined.
yep, you're right. i didn't see the exec. it will only work if the
called function somehow had access to the same
On Sat, Jun 20, 2009 at 10:25 PM, Pete Frosliefros...@gmail.com wrote:
Thank you so much.. I will start looking into twill and I just finished
installing Mechanize.
those are very well-known individual tools that will meet your needs.
for larger web testing frameworks, you may also consider
hi eddie, a few more nits to tweak...
factorialNum = 1L
change to 1 instead of 1L -- L numbers are going away and will
be permanently not available starting in 3.0.
print Factorial finder
number = int(input(Please enter a non-negative integer: ))
change input to raw_input... that is,
Hello, I thought I understood **kwargs until I stumbled with this
function:
def changeflexion(myword, mytag, **dicty):
:
but when I import the module and call:
a = conjugate.changeflexion('estaban', 'VLFin', conjugate.mydict)
I get this error:
TypeError: changeflexion() takes
But, I still get this error:
Traceback (most recent call last):
...
UnicodeEncodeError: 'ascii' codec can't encode character u'\u201c' in
position 76: ordinal not in range(128)
What am I missing?
Take a read through http://evanjones.ca/python-utf8.html which will give you
insight as to
On Thu, May 28, 2009 at 10:22 AM, Gregory Morton tyethec...@hotmail.com wrote:
I've been reading this Python 3.0.1
tutorial(http://docs.python.org/3.0/tutorial/controlflow.html), and now I'm
stuck at the second example in 4.3. This is what the example says the output
should look like:
I've been told numerous times that using __del__ is not the way to handle
clean-up because it is finicky.
matthew,
welcome to Python and this Tutor mailing list!
and yes, i'll echo everyone else in saqying that using __del__ should
be avoided. the most critical issues regarding this is
!
cheers,
-wesley
On Thu, Apr 9, 2009 at 6:04 PM, wesley chun wes...@gmail.com wrote:
Need to get up-to-speed with Python as quickly as possible? Come join
me, Wesley Chun, author of Prentice-Hall's bestseller Core Python
Programming, for a comprehensive intro course coming up this June
!
cheers,
-wesley
On Thu, Apr 9, 2009 at 3:45 PM, wesley chun wes...@gmail.com wrote:
Need to get up-to-speed with Python as quickly as possible? Come join
me, Wesley Chun, author of Prentice-Hall's bestseller Core Python
Programming, for a comprehensive intro course coming up this June
hey all,
i'm trying to collate a complete newbie-to-programming list of
resources and was wondering if you could help me fill in the holes...
thx in advance!
BOOKS
Python Programming for the Absolute Beginner (Dawson, 2005)
Python For Dummies (Maruch, Maruch, 2006)
Python Programming: An
def f(x):
'''f(x) - x+5'''
return x+5
help(f)
Help on function f in module __main__:
f(x)
f(x) - x+5
another thing that has not been mentioned is that if you put
docstrings everywhere, you can use tools like Epydoc, doxygen, or
sphinx to generate full documentation of an entire
i'm doing 3 Python knowledge/education events within the next few months.
1. APRIL: O'Reilly/Safari Books Online What is Python? webcast (FREE to all)
http://www.safaribooksonline.com/events/WhatIsPython.html
2. JUNE: Comprehensive Introduction to Python (3-day training course
in San Francisco
1. Python is not Java
although i agree with all 4 points that paul makes, this 1st one
stands out the most. when i saw the code the first time, the immediate
thought that came to my mind was, This looks like Java code written
with Python syntax. i thing the same functionality can be
accomplished
i think it's a common style guideline in multiple
languages i'm familiar with (other than Python) to Capitalize class
names but keep variables, functions, and methods all lowered.
In most cases I know, class names are capitalized, while func and method
names are camel-cased:
ThisKlass
I am new in python , so need a good books , previously read python Bible and
swaroop but not satisfied .
so tell me good books in pdf format those contents good problems also
if you like a conversational style and know at least one programming
language, i've written a pretty popular book
How can I sort the following list in a way that takes care of the right
order of numbers? The sorted function compares strings here as far as I can
see, but I want to have filepath2 follow filepath1. Your help is
appreciated.
myList
['filepath54', 'filepath25', 'filepath49', 'filepath0',
hi, and welcome to Python! my comments below...
I made a class with the name student that prints simply name of the student
as well as his roll_no also, pasting code here .
sounds pretty straightforward
class student:
def __init__(self,name,roll_no):
self.name=name
Need to get up-to-speed with Python as quickly as possible? Come join
me, Wesley Chun, author of Prentice-Hall's bestseller Core Python
Programming, for a comprehensive intro course coming up this June in
beautiful Northern California! Please pass on this note to whomever
you think may
Need to get up-to-speed with Python as quickly as possible? Come join
me, Wesley Chun, author of Prentice-Hall's bestseller Core Python
Programming, for a comprehensive intro course coming up this June in
beautiful Northern California! Please pass on this note to whomever
you think may
I am a total newbie. I have a very large file 4GB that I need to
convert from Unicode to plain text. I used to just use dos when the file
was 4GB but it no longer seems to work. Can anyone point me to some
python code that might perform this function?
can you elaborate on your conversion
Previously I was able to convert just by using:
Type Unicode_filename.txt new_text_file.txt
That's it.
wow, if that's all you had to do, i'm not sure it's worthwhile to
learning a new programming language just to process it with an
application when your original solution was so dead simple.
I would like to change it so that it can be run under both Python 3 and
Python 2.x.
everyone who has responded so far are telling about converting your
piece of code from Python 2 to Python 3, for example, using the 2to3
tool that comes with Python 2.6+:
On Tue, Mar 17, 2009 at 2:34 PM, PyProg PyProg pypro...@gmail.com wrote:
I want to use an equivalent of sets module with Python 2.6 ... but
sets module is deprecated on 2.6 version.
it is deprecated only because sets have been rolled into Python proper
starting in 2.4. replace sets.Set() with
I think the intent of 2to3 is that you maintain the
Python 2.6 version and automatically create the Python 3 version from
it. So there is only one source file. At least one person found this
practical, for a large codebase (well, he says it mostly works):
On Mon, Mar 9, 2009 at 10:38 AM, jessica cruz jessica06c...@yahoo.com wrote:
I made this program but it says that there is an error and I have a hard
time trying to solve the problem with program.
:
I don't know how to figure out the error since the only message that I get
is that
I have started learning phyton today!
I was playing around with some large numbers (fibonacci series)
and noticed that in some large calculations results have an L at the end
of a number.
Does this L stands for Large? Is there any way to disable this feature, so
that all numbers are shown?
There is a text file that looks like this:
text text text IDJoseph/text text text
text text text text text text text text text text text
text text text text text text text text text text text
text text text text text text text text text text text
text text text text text text text text text
I am looking for a good tutorial to walk through that really explains class
definition.
I assume from that you have been through the basic tutors like mine?
:
OK, I explain self in my OOP tutor topic ( a sub heading under
Using Classes), but again if thats not sufficient then you
when i call a method foo from another method func. can i access func context
variables or locals() from foo
so
def func():
i=10
foo()
in foo, can i access func's local variables
A. python has statically-nested scoping, so you can do it as long as you:
1. define foo() as an inner
when i call a method foo from another method func. can i access func context
variables or locals() from foo
so
def func():
i=10
foo()
in foo, can i access func's local variables
A. python has statically-nested scoping, so you can do it as long as you:
1. define foo() as an inner
Initally, a variable. self.stop_time is created as type datetime.time,
with the default value 06:00:00, a time stamp, during entry into the
mainloop. self.stop_time = datetime.time(10,10,10). The user reads his
configuration file with the time stamp value of 08:00:00. self.time_stop
becomes
# Date vars should be type datetime.time
config_value = str(stime)
this is pretty much the offending code right here... in fact, the
comment contradicts the assignment. it says that date vars should be
of type datetime.time, yet it assigns a *string* to config_value,
On Mon, Feb 16, 2009 at 8:24 PM, Wayne Watson
sierra_mtnv...@sbcglobal.net wrote:
I suspect I'm in need of setattr for this in a GUI program I'm modifying.
Initally, a variable. self.stop_time is created as type datetime.time, with
the default value 06:00:00, a time stamp, during entry into
On Wed, Feb 11, 2009 at 12:16 PM, Shantanoo Mahajan (शंतनू महाजन)
shanta...@gmail.com wrote:
On 12-Feb-09, at 1:31 AM, Andres Sanchez wrote:
I am trying to extract information from a spreadsheet to use it in Python.
For reading .xls: http://pypi.python.org/pypi/xlrd/0.5.2
For writing .xls:
I am trying to extract information from a spreadsheet to use it in Python.
For reading .xls: http://pypi.python.org/pypi/xlrd/0.5.2
i forgot to mention that xlrd is on version 0.6.1 now:
http://pypi.python.org/pypi/xlrd
-- wesley
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Such fun! I just wish I could afford the trip to the US! :-)
PyCons are such a great way to (re)connect with the community and so
many opportunities to learn from the masters (and mistresses) of
Python. the conferences are so incredible that once you go, you have
to go every year thereafter.
as
The script in the following can do the batch conversion from domain
name to IP:
This is a Python list, not Perl!
OMG! It's my mistake, sorry for this.
Lol..thats okay. Now that you are here and have seen what fun we have
writing Python code - why not join the party?
Don't be shy to
David Letscher and I will be leading a tutorial at this year's
PyCon titled An Introduction to Object-Oriented Programming.
likewise, i'll be doing one on network programming, so if you ever
wanted to know all about it, we take it from the lowest layer (socket
level), up thru internet
I want to search any characters in test after https://www.localhost.org/
https://www.localhost.org/testmodule/dev/trunk/admin/sql/mytest.sql and
the search will end after it finds another /
here's another solution that takes advantage of the 'maxsplit'
parameter of the str.split() method... it
if type(x) == int: # check its an integer
i also understand that it's isinstance(x, int) should be used
instead of the above or if type(x) is int but i'm running a blank as
to why at this exact moment... perhaps it's an all-C function?
however, all of these comparisons are only good if 'x'
All Python values are references, so you are essentially storing a
pointer to the function object within the problem. Python assignment
does not copy. This is a fundamental concept of Python that often
confuses newbies, it is worth taking some time to understand it
correctly. My explanation
eval(float(3/2))
That still does not work, because the 'float' comes after the
division. 3/2 equals 1, so float(3/2) equals 1.0. To make it work,
you'll have to put the float inside the division:
eval(float(3)/2)
correct. as long as one of the operands is a float, the division will
be (or
On Wed, Jan 14, 2009 at 12:01 PM, Kent Johnson ken...@tds.net wrote:
On Wed, Jan 14, 2009 at 2:36 PM, Brian van den Broek
br...@cc.umanitoba.ca wrote:
He's got python 2.6.1 installed as evidenced by the Startbar program
icon for Idle launching as expected. When run from IDLE, `print
If you have a string 6, and you do int(6), you get the number 6.
But if you have a string 2*3 and you do int(2*3) you get a name error.
the reason you get this error is because 2*3 is not a string
representation of an integer whereas 6 is. in other words 2*3 is not
a number.
How do you take
1) itertools.dropwhile(cond, lst) will return a list with the desired element
first.
i think in order to use this, the OP needs to invert his Boolean logic
because it *drops* elements while the conditional is True. as soon as
it hits False the 1st time, all remaining elements (including the
A tuple of exceptions works, just like what we did above, and more,
i.e., (IndexError, ValueError, TypeError, KeyError...
Thank you, thank you, thank you! I'm sure it's been staring me in the face,
but I never realized I could use a tuple of exception types - that's why I
said it was a pain
LoL = [['chrX', '160944034', '160944035', 'gnfX.145.788', '63.60'],
:
Now I want to cast the second and third columns from string to integer,
like this
LoL = [['chrX', 160944034, 160944035, 'gnfX.145.788', '63.60'],
:
Is there any elegant way to do this? I can't assume that
except:
pass
try not to code these 2 lines in anything that you do because it will
come back to haunt you when something is not working right but you
can't find any errors. that's because this code masks and throws away
everything!!
there are two potential error types: IndexError and
Anyhow, subprocess is working -- but I wonder if there is a way I can
send the entire *function* into its own subprocess ?
this has been a highly-desired feature for quite awhile.
starting in 2.6, you can use the new multiprocessing module
(originally called pyprocessing):
My attempt at array access (like this: array[1,2] ) does not work. What am
I overlooking? Thanks in advance! :)
:
pprint (grid.data[1,2])
is that really your name?!? you're famous! ;-) welcome to python!
i'd try...
pprint(grid.data[0][1])
... as many languages start counting at 0
On Wed, Jan 7, 2009 at 7:01 PM, bob gailer bgai...@gmail.com wrote:
Mr Gerard Kelly wrote:
How can you make a function accept a variable number of inputs without
any particular limit?
:
But what if you want to be able to call the function and put in as many
arguments as you want.
eduardo,
welcome to programming, and even better, welcome to Python! you've
done your research and found a list of great people who can help you
out.
with regards to your question, my comment are below...
list1 = ['arr', 'bre', 'grau', 'lower', 'tudo']
for item in list1:
if 'arr' in
if 'arr' or 'bell' in item:
The interpreter sees this as
if ('arr') or ('bell' in item):
'arr' always evaluates to True so the condition is always true. The
correct way to express this condition is
if 'arr' in item or 'bell' in item:
arrgh. yes, i saw this too but forgot to mention it
list1 = ['ar', 'fir', 'wo']
list2 = ['ber', 'gar', 'gt']
list3 = ['hu', 'mo', 'ko', 'tr']
list4 = ['q', 'wer', 'duh']
whole = [list1, list2, list3, list4]
for item in whole:
if 'ar' or 'ko' in item:
print item
So, the unexpected result was that I got all lists printed, when I
I make these silly programs to learn from examples I find on the list. I put
a couple together just to practice. I have heard it is not a good idea to
use sys.exit() but I can not figure out how to do it. Also any and all
comments are welcome. Thanks
david,
welcome to Python! it's
I was practicing how to use a global counter and trying to understand
how functions can interact with each other. I can understand if I can
see the error's when I run the program. I know my terminology may be
hard to follow. Also I like your book :)
you are well read since you already have
marty,
i applaud you in your efforts to port this script to the Win32
platform. the task is not as simple as one may expect, due to the
differing file pathname nomenclatures that the different operating
systems use.
because of this, i have a couple of suggestions:
1. highly recommend converting
On 11/19/08, Alan Gauld [EMAIL PROTECTED] wrote:
spir [EMAIL PROTECTED] wrote
I have not yet found any use for this feature.
Which makes it very different to an instance method. instance
methods act on instances. class methods act on the entire
class - ie they can affect all of the
based on the all the performance questions, i would say agree that
dictionary access is faster than lists (hashes exist cuz they're fast)
but they use up more memory, as shown in shawn's numbers. also, one of
the reasons why slots was added to classes was because the attribute
dictionary began to
They seem pretty similar. Here are two tests (code follows). Perhaps I
could have loaded them differently and it would have made more of a
difference. In this case I just made a list and populated the sets
from it.
Results for 999 iterations:
Set:
Load: 1.24
def nr():
nr1 = input('Enter value: ')
print str(nr1).strip('nr0')
The user input is always on the form nr08756 and i'd like to take out
the nr0 and then print the result.
I can see that there is a problem with a variable looking like pn0123
because i get: NameError: global name
201 - 300 of 512 matches
Mail list logo