Re: what does ^ do in python
On Wed, 26 Mar 2008 19:45:34 +0100, Heiko Wundram wrote: Am Mittwoch, 26. März 2008 19:04:44 schrieb David Anderson: HOw can we use express pointers as in C or python? There's no such thing as a pointer in Python, so you can't express them either. Was this what you were trying to ask? But if you really need then, you can fake them: memory = [None]*10 # get a pointer to a memory location ptr = 5 # and assign a function there memory[ptr] = lambda s: '$' + s + '$' assert memory[ptr]('hello') == '$hello$' # store a pointer to a pointer memory[3] = ptr assert memory[memory[3]]('bye') == '$bye$' In Python this is a silly trick, not worth doing because there are better ways to solve problems that other languages use pointers for. But in older languages like Fortran, before they gained pointers, this was a standard method for getting pointers into a language without pointers. Thank goodness those days are long-gone! -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: what does ^ do in python
On Mar 26, 1:36 pm, Gabriel Genellina [EMAIL PROTECTED] wrote: En Wed, 26 Mar 2008 15:04:44 -0300, David Anderson [EMAIL PROTECTED] escribió: HOw can we use express pointers as in C or python? Traceback (most recent call last): File stdin, line 1, in module File parser.py, line 123, in parse_text tree = language.parse_text(text) File english.py, line 456, in parse_text tree = self.parse_sentence(sentence) File english.py, line 345, in parse_sentence raise ParserError, can't parse %r % sentence ParserError: can't parse 'HOw can we use express pointers as in C or python?' Try to coil it up. It would explain part-of-speech errors (we make all the time over here). Coil goes so bad on blip-screen. We don't think in English. Hold. I meant, decoil it. Parts near each other on inferior rings of a circle: radius broadcasts in x**-2 (a.k.a. x/2 in logs) from a pole/ attractor, for redundancy-- distance along a harmonic around the attractor. It proposes path. Digital charter. Current sea. What's square curvature? Number's a square thought. Space and time are interchangable to verbal representations. (Space is money: see? And space doesn't grow on trees. So, what do you want for walls (same destination, new tack.-- high-dimension paths? I don't get what I (I) feel is mine-- you have to stay where you think you are. Spike the drink? What do you spike it with, nominal existence? What do -we- need and get at church, life and freedom?)? Microcircuitry and microplumbing in walls and microrecycling and microtransit could save a lot of energy and be safer and cheaper. The circles here suck. Graph vertices square and accept successfully. What is the identity relation in cause? Do you just like to build and eat coils? I'd like to (affirm/bolt) a structure that gets better at it. I deceive all the senses. My spelling is awe-ful. Am I trying to do the impossible? I like to regulate everything. What should I do? What is the good life? Give it some recoil and it works for me. Raise Locked coil. Sixth- grade English-native speakers don't discern (when prompted) commutations of 'is': 'a is c', 'b is c', therefore 'a is b'. ('Is' is causally intransitive to them.) Formal logic is pretty refined, or they're distracted. Do you? -- http://mail.python.org/mailman/listinfo/python-list
Re: what does ^ do in python
HOw can we use express pointers as in C or python? On Tue, Mar 25, 2008 at 7:36 PM, Tim Chase [EMAIL PROTECTED] wrote: In most of the languages ^ is used for 'to the power of'. No, not in most languages. In most languages (C, C++, Java, C#, Python, Fortran, ...), ^ is the xor operator ;) ...and in Pascal it's the pointer-dereferencing operator... -tkc -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: what does ^ do in python
En Wed, 26 Mar 2008 15:04:44 -0300, David Anderson [EMAIL PROTECTED] escribió: HOw can we use express pointers as in C or python? Traceback (most recent call last): File stdin, line 1, in module File parser.py, line 123, in parse_text tree = language.parse_text(text) File english.py, line 456, in parse_text tree = self.parse_sentence(sentence) File english.py, line 345, in parse_sentence raise ParserError, can't parse %r % sentence ParserError: can't parse 'HOw can we use express pointers as in C or python?' -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list
Re: what does ^ do in python
Am Mittwoch, 26. März 2008 19:04:44 schrieb David Anderson: HOw can we use express pointers as in C or python? There's no such thing as a pointer in Python, so you can't express them either. Was this what you were trying to ask? -- Heiko Wundram -- http://mail.python.org/mailman/listinfo/python-list
Re: what does ^ do in python
On Wed, Mar 26, 2008 at 1:36 PM, Gabriel Genellina [EMAIL PROTECTED] wrote: En Wed, 26 Mar 2008 15:04:44 -0300, David Anderson [EMAIL PROTECTED] escribió: HOw can we use express pointers as in C or python? File english.py, line 345, in parse_sentence raise ParserError, can't parse %r % sentence ParserError: can't parse 'HOw can we use express pointers as in C or python?' string = How can we use express pointers as in C or python? import advancedParser advancedParser.translate(string) LogicError: indication that we are not outside of python, recursive self-definition requested. (segmentation fault) all sarcasm aside if you actually meant to ask how to pass by value or pass by reference in Python, then the simple answer is don't worry about it, Python handle's things in a natural and intuitive way. If you have a specific question regarding python's handling of this concept, ask it, as some instances can be confusing and have gotchyas. -- http://mail.python.org/mailman/listinfo/python-list
Re: what does ^ do in python
HOw can we use express pointers as in C or python? Traceback (most recent call last): File stdin, line 1, in module File parser.py, line 123, in parse_text tree = language.parse_text(text) File english.py, line 456, in parse_text tree = self.parse_sentence(sentence) File english.py, line 345, in parse_sentence raise ParserError, can't parse %r % sentence ParserError: can't parse 'HOw can we use express pointers as in C or python?' Possible express pointers: http://www.geocities.com/derwin_b/sr91sign.jpg http://www.gribblenation.net/njpics/drive/78/exp78on78w.jpg http://adcentered.typepad.com/photos/uncategorized/2007/03/31/subway2.jpg If those meet the OP's need, I recommend urllib2 and PIL. -tkc -- http://mail.python.org/mailman/listinfo/python-list
Re: what does ^ do in python
Err even I cant understand what I wrote... The right question was:HOw can we use/express pointers python as in C or Pascal? But thx to Heiko, He got what I mean =) On Wed, Mar 26, 2008 at 3:46 PM, Tim Chase [EMAIL PROTECTED] wrote: HOw can we use express pointers as in C or python? Traceback (most recent call last): File stdin, line 1, in module File parser.py, line 123, in parse_text tree = language.parse_text(text) File english.py, line 456, in parse_text tree = self.parse_sentence(sentence) File english.py, line 345, in parse_sentence raise ParserError, can't parse %r % sentence ParserError: can't parse 'HOw can we use express pointers as in C or python?' Possible express pointers: http://www.geocities.com/derwin_b/sr91sign.jpg http://www.gribblenation.net/njpics/drive/78/exp78on78w.jpg http://adcentered.typepad.com/photos/uncategorized/2007/03/31/subway2.jpg If those meet the OP's need, I recommend urllib2 and PIL. -tkc -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: what does ^ do in python
ANd... By express I mean... Dereferencing... Habits from my native language where the verb express also means this On Wed, Mar 26, 2008 at 4:14 PM, David Anderson [EMAIL PROTECTED] wrote: Err even I cant understand what I wrote... The right question was:HOw can we use/express pointers python as in C or Pascal? But thx to Heiko, He got what I mean =) On Wed, Mar 26, 2008 at 3:46 PM, Tim Chase [EMAIL PROTECTED] wrote: HOw can we use express pointers as in C or python? Traceback (most recent call last): File stdin, line 1, in module File parser.py, line 123, in parse_text tree = language.parse_text(text) File english.py, line 456, in parse_text tree = self.parse_sentence(sentence) File english.py, line 345, in parse_sentence raise ParserError, can't parse %r % sentence ParserError: can't parse 'HOw can we use express pointers as in C or python?' Possible express pointers: http://www.geocities.com/derwin_b/sr91sign.jpg http://www.gribblenation.net/njpics/drive/78/exp78on78w.jpg http://adcentered.typepad.com/photos/uncategorized/2007/03/31/subway2.jpg If those meet the OP's need, I recommend urllib2 and PIL. -tkc -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: what does ^ do in python
On Wed, 26 Mar 2008 19:45:34 +0100, Heiko Wundram wrote: Am Mittwoch, 26. März 2008 19:04:44 schrieb David Anderson: HOw can we use express pointers as in C or python? There's no such thing as a pointer in Python, so you can't express them either. Was this what you were trying to ask? Strictly speaking, many objects are passed by reference, which is kind of pointer-like, even though it doesn't expose the true messiness of a true pointer. Also strictly speaking, if you use SWIG, it can wrap up pointers from other languages as a python object to be passed around within a python program. -- http://mail.python.org/mailman/listinfo/python-list
Re: what does ^ do in python
En Wed, 26 Mar 2008 16:14:07 -0300, David Anderson [EMAIL PROTECTED] escribió: The right question was:HOw can we use/express pointers python as in C or Pascal? I think you should read this article: http://effbot.org/zone/python-objects.htm and then: http://effbot.org/zone/call-by-object.htm -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list
Re: what does ^ do in python
2008/3/25, Dark Wind [EMAIL PROTECTED]: Hi, In most of the languages ^ is used for 'to the power of'. In python we have ** for that. But what does ^ do? It is bitwise xor. Some more information can be found at http://docs.python.org/ref/bitwise.html I could not get it just by using it ... some examples are: 1^1 returns 0 2^2 returns 0 1^4 returns 5 4^1 returns 5 3^5 returns 6 5^3 returns 6 .. just curious Thank you -- http://mail.python.org/mailman/listinfo/python-list -- -- Guilherme H. Polo Goncalves -- http://mail.python.org/mailman/listinfo/python-list
Re: what does ^ do in python
Dark Wind schrieb: Hi, In most of the languages ^ is used for 'to the power of'. In python we have ** for that. But what does ^ do? I could not get it just by using it ... some examples are: 1^1 returns 0 2^2 returns 0 1^4 returns 5 4^1 returns 5 3^5 returns 6 5^3 returns 6 .. ^ is exclusive or (xor) # 1 ^ 1 = 0 1 ^ 1 0 # 01 ^ 10 = 11 1 ^ 2 3 # 01 ^ 11 = 10 1 ^ 3 2 # 001 ^ 100 = 101 1 ^ 4 5 Christian -- http://mail.python.org/mailman/listinfo/python-list
Re: what does ^ do in python
Am Dienstag, 25. März 2008 23:02:00 schrieb Dark Wind: In most of the languages ^ is used for 'to the power of'. In python we have ** for that. But what does ^ do? ^ is the binary exclusive-or (xor) operator. Possibly it helps to see the following (numbers are in binary) to get the drift: 00 ^ 01 = 01 01 ^ 01 = 00 10 ^ 01 = 11 11 ^ 01 = 10 -- Heiko Wundram -- http://mail.python.org/mailman/listinfo/python-list
Re: what does ^ do in python
Hi, In most of the languages ^ is used for 'to the power of'. No, not in most languages. In most languages (C, C++, Java, C#, Python, Fortran, ...), ^ is the xor operator ;) Matthieu -- French PhD student Website : http://matthieu-brucher.developpez.com/ Blogs : http://matt.eifelle.com and http://blog.developpez.com/?blog=92 LinkedIn : http://www.linkedin.com/in/matthieubrucher -- http://mail.python.org/mailman/listinfo/python-list
Re: what does ^ do in python
In most of the languages ^ is used for 'to the power of'. No, not in most languages. In most languages (C, C++, Java, C#, Python, Fortran, ...), ^ is the xor operator ;) ...and in Pascal it's the pointer-dereferencing operator... -tkc -- http://mail.python.org/mailman/listinfo/python-list