New to working with APIs, any good tutorials/books/guides?

2014-02-21 Thread ApathyBear
I don't understand how APIs work to save my life. I am a complete beginner. In fact, I am a bit confused on what API even means and what the meaning entails. I am fairly competent with python, though I do lack some real world experience. Regardless, any tutorials/books/guides that deal with API

Re: The sum of numbers in a line from a file

2014-02-21 Thread Johannes Schneider
s = 4 e = 7 with f = file('path_to_file) as fp: for line in f: if line.startswith(name): avg = sum(map(int, filter(ambda x : len(x) > 0, s.split(' '))[s : e])) / (e - s) On 20.02.2014 17:22, kxjakkk wrote: Let

Re: Commonly-used names in the Python standard library

2014-02-21 Thread Chris Angelico
On Fri, Feb 21, 2014 at 6:21 PM, Marko Rauhamaa wrote: > Steven D'Aprano : > >> On Thu, 20 Feb 2014 12:22:29 +0200, Marko Rauhamaa wrote: >>> I'm looking forward to the day when every application can add its own >>> keywords as is customary in Lisp. >> >> And what a wonderful day that will be! Rea

Re: Remove comma from tuples in python.

2014-02-21 Thread Gary Herron
On 02/20/2014 10:49 PM, Jaydeep Patil wrote: I am getting below tuple from excel. How should i remove extra commas in each tuple to make it easy for operations. tuples is: seriesxlist1 = ((0.0), (0.01), (0.02), (0.03), (0.04), (0.05), (0.06), (0.07), (0.08), (0.09), (0.1), (0.11)) please sug

Re: Can global variable be passed into Python function?

2014-02-21 Thread Gary Herron
On 02/20/2014 10:37 PM, Sam wrote: I need to pass a global variable into a python function. However, the global variable does not seem to be assigned after the function ends. Is it because parameters are not passed by reference? How can I get function parameters to be passed by reference in Py

Re: Can global variable be passed into Python function?

2014-02-21 Thread Steven D'Aprano
On Thu, 20 Feb 2014 22:37:59 -0800, Sam wrote: > I need to pass a global variable into a python function. However, the > global variable does not seem to be assigned after the function ends. Is > it because parameters are not passed by reference? How can I get > function parameters to be passed by

Re: Can global variable be passed into Python function?

2014-02-21 Thread Jussi Piitulainen
dieter writes: > Sam writes: > > > I need to pass a global variable into a python function. > > Python does not really have the concept "variable". > > What appears to be a variable is in fact only the binding of an > object to a name. If you assign something to a variable, > all you do is bindi

Re: Remove comma from tuples in python.

2014-02-21 Thread Jussi Piitulainen
Gary Herron writes: > On 02/20/2014 10:49 PM, Jaydeep Patil wrote: > > I am getting below tuple from excel. > > How should i remove extra commas in each tuple to make it easy for > > operations. > > > > tuples is: > > seriesxlist1 = ((0.0), (0.01), (0.02), (0.03), (0.04), (0.05), (0.06), > > (0.0

Re: Commonly-used names in the Python standard library

2014-02-21 Thread Steven D'Aprano
On Fri, 21 Feb 2014 09:21:56 +0200, Marko Rauhamaa wrote: > I don't hear Lispers or C programmers complaining. Lisp is not a popular language. Despite being more powerful, more efficient, and a lot older, I expect that there are far fewer people who know Lisp (let alone use it regularly) than

NEW GROUND BREAKING STUDIES IN CREATIONIST BULLSHIT:

2014-02-21 Thread THRINAXODON'S CREATIONIST STUDIES
http://www.evolutionnews.org/2014/02/at_first_things_1082371.html , NOW FOR YOUR FAVORITE TIME SLOT: HUMANS HAVE ORIGINS IN THE DEVONIAN: https://groups.google.com/forum/#!topic/alt.atheism.holysmoke/etpGIbTPXz8 -- Thrinaxodon, the ultimate defender of USENET. -- https://mail.python.org/mailman/

Re: New to working with APIs, any good tutorials/books/guides?

2014-02-21 Thread Steven D'Aprano
On Thu, 20 Feb 2014 23:59:16 -0800, ApathyBear wrote: > I don't understand how APIs work to save my life. I am a complete > beginner. In fact, I am a bit confused on what API even means and what > the meaning entails. API stands for "Application Programming Interface", and it essentially means t

Re: Remove comma from tuples in python.

2014-02-21 Thread Alister
On Fri, 21 Feb 2014 11:13:30 +0200, Jussi Piitulainen wrote: > Gary Herron writes: > >> On 02/20/2014 10:49 PM, Jaydeep Patil wrote: >> > I am getting below tuple from excel. >> > How should i remove extra commas in each tuple to make it easy for >> > operations. >> > >> > tuples is: >> > seriesx

Re: Can global variable be passed into Python function?

2014-02-21 Thread Marko Rauhamaa
Jussi Piitulainen : > In alleged contrast, the observable behaviour of languages that "have > variables" is the same. This is not considered confusing by the people > who insist that there are no variables in Python. But of course there are variables in Python: By “frozen” we mean that all lo

Re: Commonly-used names in the Python standard library

2014-02-21 Thread Marko Rauhamaa
Chris Angelico : > How does C let you create new keywords? With #define. Nowhere near as elegant (flexible, hygienic) as in Lisp, but used to create new syntax: include/linux/list.h: #define list_for_each(pos, head) \ for (pos = (head)->next; pos != (head); pos = pos->next)

Re: Commonly-used names in the Python standard library

2014-02-21 Thread Chris Angelico
On Fri, Feb 21, 2014 at 9:26 PM, Marko Rauhamaa wrote: > Chris Angelico : > >> How does C let you create new keywords? > > With #define. Nowhere near as elegant (flexible, hygienic) as in Lisp, > but used to create new syntax: That can't create new syntax, though. All it can do is create a thing

Re:TypeError: can't multiply sequence by non-int of type 'tuple'

2014-02-21 Thread Dave Angel
Jaydeep Patil Wrote in message: > HI, > > I have a tuple. I need to make sqaure of elements of tuple and after that i > want add all suared tuple elements for total. When i trying to do it, below > error came. > > > Code: > seriesxlist1 = ((0.0,), (0.01,), (0.02,), (0.03,), (0.04,), (0.05,),

NEWS FLASH: ATHEISTS DOWN AND BLEEDING AFTER THEIR FAVORITE PET THEORY GOES DOWN THE DRAIN.

2014-02-21 Thread THRINAXODON TIMES
== >BREAKING NEWS == > THRINAXODON JUST BEAT RICHARD LEAKEY 100-0 IN WORLD SCIENCE CHAMPIONSHIP. LEAKEY WAS TRYING WITH ALL HIS MIGHT TO PROVE HUMAN'S QUATERNARY ORIGINS, BUT THRINAXODON DEFEATED HIM WITH A FEW HUMAN DEVONIAN FOSSILS. > THE FOSSILS WERE EXACT,

Re:New to working with APIs, any good tutorials/books/guides?

2014-02-21 Thread Dave Angel
ApathyBear Wrote in message: > I don't understand how APIs work to save my life. I am a complete beginner. > In fact, I am a bit confused on what API even means and what the meaning > entails. > > I am fairly competent with python, though I do lack some real world > experience. Regardless, an

Re: Commonly-used names in the Python standard library

2014-02-21 Thread Marko Rauhamaa
Chris Angelico : > On Fri, Feb 21, 2014 at 9:26 PM, Marko Rauhamaa wrote: >> With #define. Nowhere near as elegant (flexible, hygienic) as in >> Lisp, but used to create new syntax: > > That can't create new syntax, though. All it can do is create a thing > that looks like a symbol or a function

Re: Can global variable be passed into Python function?

2014-02-21 Thread Ned Batchelder
On 2/21/14 2:23 AM, dieter wrote: Sam writes: >I need to pass a global variable into a python function. Python does not really have the concept "variable". What appears to be a variable is in fact only the binding of an object to a name. If you assign something to a variable, all you do is b

Re: Can global variable be passed into Python function?

2014-02-21 Thread Marko Rauhamaa
Ned Batchelder : > Man, do I hate this idea that Python has no variables. It has > variables (names associated with values, and the values can change > over the course of the program), In classic functional programming, the values of variables can't change but they are still called variables (eve

Re: Remove comma from tuples in python.

2014-02-21 Thread Tim Chase
On 2014-02-21 09:29, Alister wrote: > >>>> seriesxlist1 = ((0.0,), (0.01,), (0.02,)) > >>>> x2 = [x*x for (x,) in seriesxlist1] > > > > I tend to omit those parentheses and use just the comma: > > > >>>> x2 = [x*x for x, in seriesxlist1] > > I had not though of using unpacking

Re: Remove comma from tuples in python.

2014-02-21 Thread Mark Lawrence
On 21/02/2014 08:27, Gary Herron wrote: A bit of notation, because I''m not sure we are communicating well here: A tuple is a Python data structure. It has no commas or parentheses. The *printing* of a Python tuple uses both for it's appearance on the output, but the tuple itself has no su

Re: Remove comma from tuples in python.

2014-02-21 Thread Peter Otten
Tim Chase wrote: > With the single-value tuple, I tend to find the parens make it more > readable, so I'd go with > > [x*x for (x,) in lst] Hardly ever seen in the wild, but unpacking works with [...], too: >>> items = zip(range(5)) >>> [x*x for [x] in items] [0, 1, 4, 9, 16] -- https://mai

Re: Cross-platform way to get default directory for binary files like console scripts?

2014-02-21 Thread Piotr Dobrogost
On Thursday, February 20, 2014 4:34:25 PM UTC+1, Piotr Dobrogost wrote: > > I'm wondering if there's some API to get this info as what you showed is > really roundabout way to achieve the goal... Turns out there is API for this - see thread on distutils-sig mailing list at https://mail.python.o

Re: Remove comma from tuples in python.

2014-02-21 Thread Roy Smith
In article , Peter Otten <__pete...@web.de> wrote: > [x*x for (x,) in lst] > > [paraphrasing...] can be better written as: > > [x*x for [x] in items] I'm torn between, "Yes, the second form is distinctly easier to read" and, "If you think the second form is easier to read, you're admitting yo

Re: Remove comma from tuples in python.

2014-02-21 Thread Travis Griggs
On Feb 21, 2014, at 6:32 AM, Roy Smith wrote: > In article , > Peter Otten <__pete...@web.de> wrote: > > >> [x*x for (x,) in lst] >> >> [paraphrasing...] can be better written as: >> >> [x*x for [x] in items] > > I'm torn between, "Yes, the second form is distinctly easier to read" > and,

Re: Can global variable be passed into Python function?

2014-02-21 Thread Travis Griggs
On Feb 21, 2014, at 4:13 AM, Ned Batchelder wrote: > Man, do I hate this idea that Python has no variables. It has variables > (names associated with values, and the values can change over the course of > the program), they just don't work the same as C or Fortran variables. In > fact, they w

Re: Remove comma from tuples in python.

2014-02-21 Thread Tim Chase
On 2014-02-21 09:48, Travis Griggs wrote: > I’ve used the comma form with struct.unpack() frequently: > > count, = struct.unpack(‘!I’, self.packet) This is *especially* one of those places I want extra parens to make sure I see what's happening. I've been stung too many times by the easy-to-miss

Re: Can global variable be passed into Python function?

2014-02-21 Thread Chris Angelico
On Sat, Feb 22, 2014 at 4:59 AM, Travis Griggs wrote: > What makes Python > variables/bindings/references/aliases/namedvalues/slots/bucketsofstuff > surprising to new arrivals from other language kingdoms, is that accessing is > pragmatically implicit (walks the scope tree for you) and assignme

Re: Just For Inquiry

2014-02-21 Thread Denis McMahon
On Thu, 20 Feb 2014 20:58:52 +0530, shivang patel wrote: > So, I kindly request to you please, give me a very brief info regarding > *Role of Project Manager*. while not project_is_finished(): take_steps_to_advance_project() -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python

property confusion

2014-02-21 Thread K Richard Pixley
Could someone please explain to me why the two values at the bottom of this example are different? Python-3.3 if it makes any difference. Is this a difference in evaluation between a class attribute and an instance attribute? --rich class C: def __init__(self): self._x = None

Re: Can global variable be passed into Python function?

2014-02-21 Thread Marko Rauhamaa
On the question of how variables can be passed to functions, C, of course, has the & operator and Pascal has the "var" keyword. An analogous thing can be achieved in Python 3 (but not in Python 2, I'm afraid). The & operator corresponds to an ad hoc property class as in the program below (not int

Re: property confusion

2014-02-21 Thread Rotwang
On 21/02/2014 18:58, K Richard Pixley wrote: Could someone please explain to me why the two values at the bottom of this example are different? Python-3.3 if it makes any difference. Is this a difference in evaluation between a class attribute and an instance attribute? Yes, see below. --r

Re: Commonly-used names in the Python standard library

2014-02-21 Thread Ethan Furman
On 02/21/2014 04:03 AM, Marko Rauhamaa wrote: With the addition of macros, Python would become a (remote) Lisp dialect. Defining macros would become more complicated because of Python's more complex "supersyntax." Have you tried MacroPy? If not, you should. If so, what were its failings? --

Re: New to working with APIs, any good tutorials/books/guides?

2014-02-21 Thread ApathyBear
Thanks, I think I have an understanding of what they are, but now am still a little confused on how one goes about using it: how am I supposed to know how to use an API in python? or in any other language for that matter? If an API is defining rules in C, is all hope lost for trying to use it in

Re: New to working with APIs, any good tutorials/books/guides?

2014-02-21 Thread Joel Goldstick
On Feb 21, 2014 3:15 PM, "ApathyBear" wrote: > > Thanks, I think I have an understanding of what they are, but now am still a little confused on how one goes about using it: how am I supposed to know how to use an API in python? or in any other language for that matter? If an API is defining rules

Re: Commonly-used names in the Python standard library

2014-02-21 Thread 88888 Dihedral
On Friday, February 21, 2014 12:26:00 AM UTC+8, Marko Rauhamaa wrote: > Chris Angelico : > > > > > Also, what happens if two modules (one of which might be your script) > > > written for different versions both import some third module? Should > > > they get different versions, based on what v

Storing the state of script between steps

2014-02-21 Thread Denis Usanov
Good evening. First of all I would like to apologize for the name of topic. I really didn't know how to name it more correctly. I mostly develop on Python some automation scripts such as deployment (it's not about fabric and may be not ssh at all), testing something, etc. In this terms I have

new life at comp.misc

2014-02-21 Thread RS Wood
If you weren't already aware, a bunch of people who usually read slashdot.org got frustrated and went back to Usenet, partly because of the new slashdot beta interface Dice Media is imposing, partly because we all suddenly remembered how much we love Usenet. We all landed at comp.misc. If you lo

solutions manual and test banks

2014-02-21 Thread ineedsolutionsbook
ineedsolutionsbook(at)hotmail.com i n e e d s o l u t i o n s b o o k @ h o t m a i l . c o m We're a team found for providing solution manuals to help students in their study. We sell the books in a soft copy, PDF format. We will do our best to find any book or solution manual for you. Be

Re: Win32 Write RAW Physical Disk Python 3.3.2

2014-02-21 Thread khanta
Can anyone tell me if it is not possible? It would save me a lot of time. Has anyone ever written to the raw disk on windows? On Wednesday, February 19, 2014 7:42:02 AM UTC-5, khanta wrote: > Hello, > > I am trying to write to the raw physical disk on Windows 8.1 but I > > get an error: >

Re: inheriting a large python code base

2014-02-21 Thread craig
Look at the algorithms and see if there are faster ways. Great advice with the comments of writing test cases, getting into version control, taking passes through the code with tools, understanding what is slow and why it is considered slow. Then you should invest the time to understand the in

Re: Win32 Write RAW Physical Disk Python 3.3.2

2014-02-21 Thread Mark Lawrence
On 21/02/2014 21:32, kha...@gmail.com wrote: Can anyone tell me if it is not possible? It would save me a lot of time. Has anyone ever written to the raw disk on windows? Sorry I can't help you, but you're more likely to get answers if you didn't top post and you use a decent email client or

Re: Win32 Write RAW Physical Disk Python 3.3.2

2014-02-21 Thread Jerry Hill
On Wed, Feb 19, 2014 at 7:42 AM, khanta wrote: > Hello, > I am trying to write to the raw physical disk on Windows 8.1 but I > get an error: > PermissionError: [Errno 13] Permission denied: '.\\PHYSICALDRIVE2' Is there a volume mounted from the drive at the time you're attempting to writ

Re: Error getting REMOTE_USER Environment Variable

2014-02-21 Thread Hobie Audet
How many other environment variables are doubled? All of them? The only other environment variable I have tried is REMOTE_ADDR, and that does not appear to be doubled. Does the problem exist when the Python script is run directly, outside Abyss, or in IDLE, for example? The problem is

Re: Error getting REMOTE_USER Environment Variable

2014-02-21 Thread MRAB
On 2014-02-21 22:48, Hobie Audet wrote: How many other environment variables are doubled? All of them? The only other environment variable I have tried is REMOTE_ADDR, and that does not appear to be doubled. Does the problem exist when the Python script is run directly, outside Abyss, or in

is there a package similar to SHINY in R for python ...

2014-02-21 Thread anujg1984
I want to have textboxes, sliders, and buttons in the web browser that change the data visualization just like shiny does in R. Is there something like that in python. Bokeh makes graphs in the browser, but they dont provide a way to manipulate the graph with sliders, textboxes etc. ? -- http

Re: Storing the state of script between steps

2014-02-21 Thread Cameron Simpson
On 21Feb2014 12:59, Denis Usanov wrote: > I mostly develop on Python some automation scripts such as deployment (it's > not about fabric and may be not ssh at all), testing something, etc. In this > terms I have such abstraction as "step". > > Some code: > > class IStep(object): > def run(

Python and variables (was: Can global variable be passed into Python function?)

2014-02-21 Thread Ben Finney
Ned Batchelder writes: > On 2/21/14 2:23 AM, dieter wrote: > > Sam writes: > > > >> >I need to pass a global variable into a python function. > > Python does not really have the concept "variable". > > > > What appears to be a variable is in fact only the binding of an > > object to a name. If y

Re: Function and turtle help

2014-02-21 Thread Scott W Dunning
On Feb 20, 2014, at 11:30 PM, Dave Angel wrote: > Look at turtle.begin_fill and turtle.end_fill > > That's after making sure your star is a closed shape. So, this is what I have so far and it “works” but, it fills in the star with black and as you can see below I am trying to fill it in wit

Re: New to working with APIs, any good tutorials/books/guides?

2014-02-21 Thread Roy Smith
In article <3fa5e368-a47c-4a7e-80dc-c5333fb56...@googlegroups.com>, ApathyBear wrote: > Thanks, I think I have an understanding of what they are, but now am still a > little confused on how one goes about using it: how am I supposed to know how > to use an API in python? or in any other langua

Re: Function and turtle help

2014-02-21 Thread Dave Angel
Scott W Dunning Wrote in message: > > On Feb 20, 2014, at 11:30 PM, Dave Angel wrote: > >> Look at turtle.begin_fill and turtle.end_fill >> >> That's after making sure your star is a closed shape. > > > > So, this is what I have so far and it “works” but, it fills in the star > with b

Re: New to working with APIs, any good tutorials/books/guides?

2014-02-21 Thread Steven D'Aprano
On Fri, 21 Feb 2014 12:12:00 -0800, ApathyBear wrote: > Thanks, I think I have an understanding of what they are, but now am > still a little confused on how one goes about using it: how am I > supposed to know how to use an API in python? *scratches head* Er, first you learn how to program in

Re: is there a package similar to SHINY in R for python ...

2014-02-21 Thread Michael Torrie
On 02/21/2014 07:57 PM, Dennis Lee Bieber wrote: > On Fri, 21 Feb 2014 15:28:55 -0800 (PST), anujg1...@gmail.com declaimed the > following: > >> I want to have textboxes, sliders, and buttons in the web browser that >> change the data visualization just like shiny does in R. >> >> Is there someth

Re: Can global variable be passed into Python function?

2014-02-21 Thread Ned Batchelder
On 2/21/14 9:47 PM, Dennis Lee Bieber wrote: On Fri, 21 Feb 2014 09:59:17 -0800, Travis Griggs declaimed the following: On Feb 21, 2014, at 4:13 AM, Ned Batchelder wrote: Man, do I hate this idea that Python has no variables. It has variables (names associated with values, and the values

Re: IDLE won't run after installing Python 3.3 in Windows

2014-02-21 Thread Mark H. Harris
On Tuesday, February 18, 2014 8:56:51 AM UTC-6, eglows...@gmail.com wrote: > Any suggestions? Thanks in advance! > Is there any possibility that you are bumping up against open IDLE Issue 14576? http://bugs.python.org/issue14576 -- https://mail.python.org/mailman/listinfo/python-list

Re: Can global variable be passed into Python function?

2014-02-21 Thread Steven D'Aprano
On Fri, 21 Feb 2014 07:13:25 -0500, Ned Batchelder wrote: > On 2/21/14 2:23 AM, dieter wrote: >> Sam writes: >> >>> >I need to pass a global variable into a python function. >> Python does not really have the concept "variable". >> >> What appears to be a variable is in fact only the binding of a

Re: Storing the state of script between steps

2014-02-21 Thread Steven D'Aprano
On Fri, 21 Feb 2014 12:59:11 -0800, Denis Usanov wrote: > I mostly develop on Python some automation scripts such as deployment > (it's not about fabric and may be not ssh at all), testing something, > etc. In this terms I have such abstraction as "step". > > Some code: > > class IStep(object):

Re: Can global variable be passed into Python function?

2014-02-21 Thread Ned Batchelder
On 2/21/14 10:28 PM, Steven D'Aprano wrote: On Fri, 21 Feb 2014 07:13:25 -0500, Ned Batchelder wrote: On 2/21/14 2:23 AM, dieter wrote: Sam writes: I need to pass a global variable into a python function. Python does not really have the concept "variable". What appears to be a variable is

Re: New to working with APIs, any good tutorials/books/guides?

2014-02-21 Thread Cameron Simpson
On 22Feb2014 02:45, Steven D'Aprano wrote: > On Fri, 21 Feb 2014 12:12:00 -0800, ApathyBear wrote: > > [...] or in any other language > > for that matter? If an API is defining rules in C, is all hope lost for > > trying to use it in python? > > If an API is defined for a C library or function,

Re: Function and turtle help

2014-02-21 Thread Scott W Dunning
On Feb 21, 2014, at 7:13 PM, Dave Angel wrote: > Scott W Dunning Wrote in message: >> >> On Feb 20, 2014, at 11:30 PM, Dave Angel wrote: >> >>> Look at turtle.begin_fill and turtle.end_fill >>> >>> That's after making sure your star is a closed shape. >> >> >> >> So, this is what I have

Re: Function and turtle help

2014-02-21 Thread Dave Angel
On 02/21/2014 10:38 PM, Scott W Dunning wrote: On Feb 21, 2014, at 7:13 PM, Dave Angel wrote: Scott W Dunning Wrote in message: On Feb 20, 2014, at 11:30 PM, Dave Angel wrote: Look at turtle.begin_fill and turtle.end_fill That's after making sure your star is a closed shape. So, th

Re: Can global variable be passed into Python function?

2014-02-21 Thread Steven D'Aprano
On Fri, 21 Feb 2014 22:45:14 -0500, Ned Batchelder wrote: > I think it might be that the OP's question, "Can a global variable be > passed into a function", really had nothing to do with the > name/value/variable distinction, and we've done it again: taken a simple > question and spun off into ped

Re: Can global variable be passed into Python function?

2014-02-21 Thread Chris Angelico
On Sat, Feb 22, 2014 at 6:20 AM, Marko Rauhamaa wrote: > On the question of how variables can be passed to functions, C, of > course, has the & operator and Pascal has the "var" keyword. That doesn't pass a variable into a function, though. It passes the address of that variable, and C lets you s

Re: Can global variable be passed into Python function?

2014-02-21 Thread Steven D'Aprano
On Fri, 21 Feb 2014 21:20:12 +0200, Marko Rauhamaa wrote: > On the question of how variables can be passed to functions, C, of > course, has the & operator and Pascal has the "var" keyword. > > An analogous thing can be achieved in Python 3 (but not in Python 2, I'm > afraid). The & operator corr

Re: Can global variable be passed into Python function?

2014-02-21 Thread Steven D'Aprano
On Sat, 22 Feb 2014 17:36:52 +1100, Chris Angelico wrote: > On Sat, Feb 22, 2014 at 6:20 AM, Marko Rauhamaa > wrote: >> On the question of how variables can be passed to functions, C, of >> course, has the & operator and Pascal has the "var" keyword. > > That doesn't pass a variable into a funct

Re: Can global variable be passed into Python function?

2014-02-21 Thread Chris Angelico
On Sat, Feb 22, 2014 at 6:18 PM, Steven D'Aprano wrote: > Now I daresay that under the hood, Pascal is passing the address of foo > (or bar) to the procedure plus, but inside plus you don't see that > address as the value of b. You see the value of foo (or bar). > > C does not do that -- you have

Re: Can global variable be passed into Python function?

2014-02-21 Thread Marko Rauhamaa
Steven D'Aprano : > But your code doesn't succeed at doing what it sets out to do. If you try > to call it like this: > > py> x = 23 > py> y = 42 > py> swap(x, y) > Traceback (most recent call last): > File "", line 1, in > File "", line 2, in swap > AttributeError: 'int' object has no attri