r you. Why implement
a linked list, when we already have lists? Then Queues and Stacks are
trivial to implement once you've got lists.
If you're interested in learning more about data structures and their
uses, this looks like a good reference:
ht
27;, 'email': '[EMAIL PROTECTED]'}
Key: name
Data: jordan
Key: email
Data: [EMAIL PROTECTED]
So, to summarize, *args and **kwargs are basically there so you can
build your functions so that they can accept a variable number of arguments.
We had a thread about this
Hans Dushanthakumar wrote:
> Hi,
>How do I use python for basic web-tasks like inputting data or
> clicking buttons on web-pages. For eg, how do I enter my username and
> password and click on the "OK" button on the yahoo mail page?
> I had a look at the webbrowser module documentation
> (http:
something_to_log() just like it was defined in that file.
Example:
#file: test1.py
def spam():
print "Spam, eggs, and toast"
#file: myscript.py
from test1 import spam
spam()
#prints "Spam, eggs, and toast"
Hope this helps!
-Jordan Greenberg
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
issors
That'll take care of the basics for ya. Later you could try and keep
frequency counts over a bunch of trials, see if the human has a
preference, and then weight your response appropriately to try and beat
them ;)
-Jordan Greenberg
___
Tuto
Christopher Spears wrote:
> Hmmm...Perl is probably a bad example. My apologies.
> I was thinking more along the lines of this:
>
> A C++ for loop:
>
> #include
>
> using std::cout;
>
> int main() {
>
> for (int i = 0; i < 10; i++) {
> cout << i << "\n";
> }
bles as containers.
That thinking isn't valid in Python. In Python, what you'd think of as
'variables' are just names for objects. (If you know C++, think
pointers, sort of. myDie isn't the Die Object, its just a reference as
to where the object is. Assigning to a pointer do
return self.val, other
In [2]: test=coerceTest(5)
In [3]: test
Out[3]: <__main__.coerceTest instance at 0x00E29620>
In [4]: result=test+10
In [5]: result
Out[5]: 15
In [6]: test=5
In [7]: test
Out[7]: 5
(I could've written a test to show that __coerce__ is only called when
n
le object as a
parameter, but theres no object left to pass it.
HTH.
-Jordan Greenberg
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Yi Qiang wrote:
> Hi,
> I am trying to get some basic information about the computer's
> hardware specs in OSX in python. In linux I can get most of what I
> need from the /proc filesystem. Is there an equivalent in OSX? If
> not, where else can I get information about the system from? I need
>
ROTECTED]) so my messages
will come from there from now on.
Sorry again for the test,
Jordan Greenberg
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Chris Hengge wrote:
> Anyone point me to something more efficient then
>
> for item in list1:
> if item not in list2:
> list2.append()
>
> This just seems to take a bit a time when there are thousands or dozens of
> thousands of records just to filter out the dozen or so copies..
>
Toon Pieton wrote:
> Hey friedly users!
>
> I was wondering: how can I get the directory the program is in? For example
> "C:\Python Programs\Calculator\".
>
> Thanks in advance for reading,
> Toon Pieton
>
Slightly hackish and nasty, but seems to do the trick. Someone'll
probably suggest a bet
est.py
test.py
[EMAIL PROTECTED]:~$ cd /
[EMAIL PROTECTED]:/$ python test.py
/home/jordan/test.py
[EMAIL PROTECTED]:/$
So, if you _ALWAYS_ need an absolute path, just using sys.argv[0] might
not work.
Jordan Greenberg
___
Tutor maillist - Tutor@python.or
Smith, Jeff wrote:
> I find a common thing to do is
>
> l = list()
> for i in some-iterator:
> if somefum(i) != list:
> l.append(somefun(i))
How about using the same condition you do in the if? Like:
l=[somefun(i) for i in some-iterator if not type(somefun(i)) is list]
HTH
Jordan
_
Andreas Pfrengle wrote:
> Bob Gailer wrote:
>
>> Andreas Pfrengle wrote:
>>
>>> Hello,
>>>
>>> I want to change the value of a variable whose name I don't know, but
>>> this name is stored as a string in another variable, like:
>>>
>>> x = 1
>>> var = 'x'
>>>
>>> Now I want to change the value of
complete IDE solution goes, PyDev for the Eclipse platform is pretty
popular. If you're willing to spend some $$$, then PyDev Extensions
(also for Eclipse) are good, or ActiveState's Komodo IDE. They seem to
be the gold standard.
-Jordan Greenberg
_
Martin Walsh wrote:
> def addcommas(f):
> """
> This amounts to reversing everything left
> of the decimal, grouping by 3s, joining
> with commas, reversing and reassembling.
> """
> # assumes type(f) == float
> left, right = ('%0.2f' % f).split('.')
> rleft = [left[::-1][i:i+3] fo
Shrutarshi Basu wrote:
I'm working on a graph class to become more familiar with graphs in
general. I'd like to be able to do something like 'print gr' and get
something intelligible like a list of vertices. But using print on a
Graph class instance simply returns
Is there someway I can change
19 matches
Mail list logo