Re: ModuleNotFoundError

2022-06-17 Thread inhahe
sys is a built-in module, but it's not in the namespace unless you import it first. before your print statement, enter "import sys" On Fri, Jun 17, 2022 at 8:23 AM wrote: > Thank you for your email. > > C:\Users\zszen>python.exe > Python 3.10.5 (tags/v3.10.5:f377153, Jun 6 2022, 16:14:13) [MSC

Re: ModuleNotFoundError

2022-06-17 Thread inhahe
sorry, I may have misused the term "namespace." I'm not sure what the proper word is for the names currently loaded into the global scope. On Fri, Jun 17, 2022 at 8:26 AM inhahe wrote: > sys is a built-in module, but it's not in the namespace unless you import > it

Re: it seems like a few weeks ago... but actually it was more like 30 years ago that i was programming in C, and

2023-02-27 Thread inhahe
On Mon, Feb 27, 2023 at 3:52 AM Roel Schroeven wrote: > Op 26/02/2023 om 6:53 schreef Hen Hanna: > > > There are some similarities between Python and Lisp-family > > > languages, but really Python is its own thing. > > > > > > Scope (and extent ?) of variables is one reminder that Python i

Re: it seems like a few weeks ago... but actually it was more like 30 years ago that i was programming in C, and

2023-02-27 Thread inhahe
On Mon, Feb 27, 2023 at 3:56 AM inhahe wrote: > > > On Mon, Feb 27, 2023 at 3:52 AM Roel Schroeven > wrote: > >> Op 26/02/2023 om 6:53 schreef Hen Hanna: >> > > There are some similarities between Python and Lisp-family >> > >

Re: editor recommendations?

2021-02-26 Thread inhahe
My editor of choice is Komodo IDE, which used to be commercialware but is free now. I'm pretty sure it has dark modes, but I haven't used them. I just thought I'd mention it because it's a good, solid IDE but I never see anybody mention it, e.g. in lists of Python editors and such.. On Fri, Feb 26

Fwd: How to cycle through servers on Connection Fail in an IRC client?

2021-02-27 Thread inhahe
I'm not sure if it's okay to ask about Twisted in this mailing list, but Twisted's mailing list seems to have ignored my submission for some reason. And their mailing list seems mostly dead anyway. So here goes: I'm making an IRC client using Twisted, and I want to connect to a different server w

Re: Python language packages isn't working in Visual Studio Code

2021-05-03 Thread inhahe
I don't think attaching images works on this kind of list. Maybe send a link to it.. On Mon, May 3, 2021 at 1:51 PM Osmany Guerra wrote: > Hi, I have problem with the python interpreter in the Visual Studio Code. > It was running ok, but now isn't working. I have downloaded, installed and > unis

Re: How to debug python + curses? [was: RE: Applying winpdb_reborn]

2021-06-06 Thread inhahe
On Sun, May 30, 2021 at 1:43 PM wrote: > I tried winpdb-reborn some time last year on my Win10 system (python 3.8.3 > at that time), but could not figure out how to use it to debug a python > script that uses the curses module. > > Does anyone here know if winpdb-reborn or any other debugger can

Re: NOT ABLE TO SEE PICTURES

2021-12-01 Thread inhahe
Maybe your file explorer is set to ignore system and/or hidden files, and Python isn't? You can check that in folder settings.. On Wed, Dec 1, 2021 at 10:31 AM Ragavendar wrote: >When the python runs in file explorer when I open a folder it shows NO >ITEAMS FOUND and if I open same folde

Can't figure out how to do something using ctypes (and maybe struct?)

2018-08-10 Thread inhahe
I need to make a list of instances of a Structure, then I need to make an instance of another Structure, one of the fields of which needs to be an arbitrary-length array of pointers to the instances in the list. How do I do that? Just in case it helps, I'll include what I tried that didn't work: -

help! PyQt4 and UTF-8

2018-08-14 Thread inhahe
I can display UTF-8 when I use wxPython: -- import wx app = wx.App() s = 'testing\xf0\x9f\x98\x80' frame = wx.Frame(None, wx.ID_ANY) font = wx.Font("Arial") textbox = wx.TextCtrl(frame, id=wx.ID_ANY) textbox.SetFont(font) textbox.WriteText(s) frame.Show() app.MainLoop() -- But when I try th

Re: Help a noob out

2019-05-02 Thread inhahe
On Thu, May 2, 2019 at 5:26 AM wrote: > Hey guys, can someone quickly explain why this piece of code doesn't work? > (I'm really new to Python) > > birth_year = input("What year are you born? ") > current_year = 2019 > age = current_year - birth_year > print(age) > -- > https://mail.python.org/ma

Re: What does at 0x0402C7B0> mean?

2019-05-22 Thread inhahe
Short answer: (some generator expression) is for iterating over, as others have said. try this: print([fruit for fruit in favorite_fruits]) a loop would work too, as someone mentioned, but the result would be different. you'd get your fruits separated by line breaks (or something else if you speci

Re: PEP 594 cgi & cgitb removal

2019-05-22 Thread inhahe
Re cgitb, not sure if this is what you want, but I just came across this this week: https://github.com/cknd/stackprinter On Wed, May 22, 2019 at 3:52 AM Robin Becker wrote: > In PEP 594 t has been proposed that cgi & cgitb should be removed. I > suspect I am not the only person in the world tha

Re: Handle foreign character web input

2019-06-28 Thread inhahe
: > > On 6/28/19 1:33 PM, Chris Angelico wrote:> On Sat, Jun 29, 2019 at 6:31 AM > Tobiah wrote: > > >> Also, what do people do when searching for a record. > >> Is there some way to get 'Ronngren' to match the other > >> possible foreign spellings? > > > > I think I've heard of algorithms that

Re: phyton

2019-09-10 Thread inhahe
On Tue, Sep 10, 2019 at 8:10 AM tim.gast--- via Python-list < [email protected]> wrote: > Op dinsdag 10 september 2019 13:03:46 UTC+2 schreef [email protected]: > > Hi everybody, > > > > For school i need to write the right code to get the following outcome. > > Can someone help me with this

Re: phyton

2019-09-10 Thread inhahe
On Tue, Sep 10, 2019 at 8:31 AM inhahe wrote: > > > On Tue, Sep 10, 2019 at 8:10 AM tim.gast--- via Python-list < > [email protected]> wrote: > >> Op dinsdag 10 september 2019 13:03:46 UTC+2 schreef [email protected]: >> > Hi everybody, >> > &

Re: phyton

2019-09-10 Thread inhahe
On Tue, Sep 10, 2019 at 8:41 AM Pankaj Jangid wrote: > [email protected] writes: > > > For school i need to write the right code to get the following outcome. > > Can someone help me with this > > I can't find a solution to link the word high to 1.21. > > > > 11 print(add_vat(101, 'high'))

Re: phyton

2019-09-10 Thread inhahe
gt; > Can someone help me with this > > I can't find a solution to link the word high to 1.21. > > > > 11 print(add_vat(101, 'high')) > > 12 print(add_vat(101, 'low')) > > > > Outcome: > > > > 122.21 > > 110.09 >

Re: Sandboxing eval()

2020-01-21 Thread inhahe
> I have written a simple parser/evaluator that is sufficient for my > simple requirements, and I thought I was safe. > > Then I saw this comment in a recent post by Robin Becker of ReportLab - > > "avoiding simple things like ' '*(10**200) seems quite difficult" > > I realised that my method

Fwd: python script to give a list of prime no.

2020-04-05 Thread inhahe
On Sun, Apr 5, 2020 at 8:26 AM Sathvik Babu Veligatla < [email protected]> wrote: > hi, > I am new to python, and i am trying to output the prime numbers beginning > from 3 and i cannot get the required output. > It stops after giving the output "7" and that's it. > > CODE: > a = 3 > l =

Re: Asynchronous generators

2020-06-23 Thread inhahe
I know of a URL that explains asyncio: https://hackernoon.com/a-simple-introduction-to-pythons-asyncio-595d9c9ecf8c. As to your specific problem, I can't help and don't know if the URL helps. I haven't studied asyncio much. On Tue, Jun 23, 2020 at 3:53 PM Jonathan Gossage wrote: > -- > I am atte

Re: Any better way for this removal?

2020-11-07 Thread inhahe
> > > On Sat, Nov 7, 2020 at 8:51 AM Bischoop wrote: > >> >> >> So I was training with slicing. >> Came to idea to remove text after second occurence of character, below >> is how I've figured it out, I know if it works it good but how you >> guys would made it in more pythonic way? >> >> text

Re: returning totals in functions of math

2020-11-08 Thread inhahe
On Sun, Nov 8, 2020 at 1:51 PM Quentin Bock wrote: > Errors say that add takes 1 positional argument but 3 were given? Does this > limit how many numbers I can have or do I need other variables? > Here is what I have: > def add(numbers): >total = 1 >for x in numbers: > total +=

Re: How can I make this more complex?

2020-11-09 Thread inhahe
if 100 > grade >= 90: On Mon, Nov 9, 2020 at 6:01 PM Quentin Bock wrote: > grade = input("Enter your grade: ") > if grade >= 90: > print("You got an A ") > if grade >= 80: > print("You got a B ") > if grade >= 70: > print("You got a C") > if grade >= 60: > print("You got a D ")

Re: Letter replacer - suggestions?

2020-12-07 Thread inhahe
Besides what others have said (especially re using a dict instead), I think it's unpythonic/can result in unexpected behavior to change a list as it's being iterated over. Your modified word_list should be a separate list, I think. Also, if you use enumerate(), you won't have to use .index and it w

Why do look-ahead and look-behind have to be fixed-width patterns?

2005-01-27 Thread inhahe
Hi i'm a newbie at this and probably always will be, so don't be surprised if I don't know what i'm talking about. but I don't understand why regex look-behinds (and look-aheads) have to be fixed-width patterns. i'm getting the impression that it's supposed to make searching exponentially slower

Question about how to do something in BeautifulSoup?

2016-01-22 Thread inhahe
I hope this is an appropriate mailing list for BeautifulSoup questions, it's been a long time since I've used python-list and I don't remember if third-party modules are on topic. I did try posting to the BeautifulSoup mailing list on Google groups, but I've waited a day or two and my message hasn'

Re: splitting strings with python

2005-06-09 Thread inhahe
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > im trying to split a string with this form (the string is from a > japanese dictionary file with mulitple definitions in english for each > japanese word) > > > str1 [str2] / (def1, ...) (1) def2 / def3 / (2) def4/ def5 ... / > > >

Python+Pyjamas+V8=ftw

2008-11-26 Thread inhahe
I don't know how much the community knows about this - i haven't been participating much of late - but here's something amazing. Apparently javascript is just as dynamic as python, because someone made a python-to-javascript converter in just 1200 line (pyjamas). Meanwhile google's new javascr

how to pass a python socket to a .dll?

2008-05-13 Thread inhahe
i'm trying to make a .dll that will let me use WSAPoll, which is a windows sockets function, to mimic select.poll on a windows box. i cbb learning python extensions, so i'm just going to use ctypes with a dll, so I hope that it doesn't bring up a big performance issue. anyway, the problem is

Re: list index out of range

2008-05-13 Thread inhahe
random.randint(x,y) returns a random integer between _and including_ x and y, so randint(0, len(deck)) might return len(deck) and since python's indices start at 0, the maximum index is len(deck)-1. rather than using randint(0,len(deck)-1) you could just do card = random.choice(deck) HAND.append

Re: I'm stuck in Python!

2008-05-13 Thread inhahe
"George Sakkis" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On May 13, 9:46 am, Sanoski <[EMAIL PROTECTED]> wrote: > >> Any programming that helps you solve a problem is fun and >> recreational. At least, that's how I look at it. I suppose it really >> depends on why you're doin

writing python extensions in assembly

2008-05-16 Thread inhahe
Can anyone give me pointers/instructions/a template for writing a Python extension in assembly (or better, HLA)? -- http://mail.python.org/mailman/listinfo/python-list

Re: ply yacc lineno not working?

2008-05-16 Thread inhahe
I dunno but on Dos/Windows a newline is usually \r\n (although that still includes a \n..) "Laszlo Nagy" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I'm sorry for the dumb question. I had to add these to the lexer: > > def t_comment(t): >r"\#[^\n]*\n" >t.lexer.lineno +=

Re: Variable by label

2008-05-16 Thread inhahe
>>> a = 1 >>> b = eval("a") >>> b 1 >>> a =1 >>> b = globals()["a"] >>> b 1 >>> a =1 >>> b = locals()["a"] >>> b 1 <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Is there any function which will return a variable by passing to it > the string containing the variable's name? Somethin

Re: writing python extensions in assembly

2008-05-16 Thread inhahe
ons at the same time. I thought of making a c extension with embedded asm, but that just seemed less than ideal. But if somebody thinks that's the Right Way to do it, that's good enough.. "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED

Re: writing python extensions in assembly

2008-05-16 Thread inhahe
s for different systems. How wide a variety of systems I'd support I don't know. As a bare minimum, 32-bit x86, 64-bit x86, and one or more of their available forms of SIMD. "D'Arcy J.M. Cain" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >

Re: morning in Python

2008-05-16 Thread inhahe
I'm not an expert in this but what does it mean to emphasize state? It seems the opposite of that would be a) functional programming, and b) passing parameters instead of using global or relatively local variables. And maybe c) coroutines (generators as implemented in Python), although perhaps

Re: writing python extensions in assembly

2008-05-16 Thread inhahe
I like to learn what I need, but I have done assembly before, I wrote a terminal program in assembly for example, with ansi and avatar support. I'm just not fluent in much other than the language itself, per se. Perhaps C would be as fast as my asm would, but C would not allow me to use SIMD,

Re: writing python extensions in assembly

2008-05-16 Thread inhahe
"D'Arcy J.M. Cain" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > 2. Once the code is functioning, benchmark it and find the > bottlenecks. Replace the problem methods with a C extension. Refactor > (and check your unit tests again) if needed to break out the problem > areas in

Re: Thread killing - I know I know!

2008-05-16 Thread inhahe
I'm not sure it's possible to kill a thread in Python that's in the middle of a C function. I know you can't do it with signals, for example. Or can you? I'm on Windows and signals isn't fully implemented. I had to do just this, btw, so I wrote another Python program that communicates with t

Re: Thread killing - I know I know!

2008-05-16 Thread inhahe
I'm not sure it's possible to kill a thread in Python that's in the middle of a C function. I know you can't do it with signals, for example. Or can you? I'm on Windows and signals isn't fully implemented. I had to do just this, btw, so I wrote another Python program that communicates with the

Re: writing python extensions in assembly

2008-05-16 Thread inhahe
"Dan Upton" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > On Fri, May 16, 2008 at 1:27 PM, Mensanator <[EMAIL PROTECTED]> wrote: >> >> Why wouldn't the compilers support it? It's part of the x86 >> architexture, >> isn't it? > > Yeah, but I don't know if it uses it by default,

Re: morning in Python

2008-05-16 Thread inhahe
"George Sakkis" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] On May 16, 11:58 am, "inhahe" <[EMAIL PROTECTED]> wrote: > I'm not an expert in this but what does it mean to emphasize state? It > seems the opposite of that would be

help compiling Python on vs 2008!

2008-05-16 Thread inhahe
In order to compile Python, I need to compile 7 external libraries manually that don't come with Python, the first being tcl. I'm compiling on VS 2008. Since the Python source doesn't have a PCBuild9 directory, I'm using the PCBuild8 directory. When following readme.txt to a T, tcl won't compile

Re: Python-list Digest, Vol 56, Issue 311

2008-05-17 Thread inhahe
didn't mean to re-post the whole digest. i forgot to clip what was after this message. On Sat, May 17, 2008 at 2:59 PM, inhahe <[EMAIL PROTECTED]> wrote: > i just installed visual studio 8 and tried to compile again, and I got the > same exact problem. > > > >

Re: help compiling Python on vs 2008!

2008-05-17 Thread inhahe
"Christian Heimes" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > inhahe schrieb: >> what is going on here, and how do I compile these external libraries? > > I assume you are trying to compile Python 2.5 with VS 9.0. It's not > supported.

Re: Using Python for programming algorithms

2008-05-17 Thread inhahe
what little I know: The numbers I heard are that Python is 10-100 times slower than C. So use Python if you can wait 10-100 times longer. Although it won't really be that slow using numpy and/or psyco. Python seems to have a really extensive reportoire of modules available for it. Although

Re: help compiling Python on vs 2008!

2008-05-17 Thread inhahe
VS2005 seems to be officially supported. Here's part of the readme file in the PCBuild8 directory in the Python 2.5 source. " Building Python using VC++ 8.0 - This directory is used to build Python for Win32 platforms, e.g. Windows 95, 98 and NT. It requires

Re: help compiling Python on vs 2008!

2008-05-17 Thread inhahe
"inhahe" <[EMAIL PROTECTED]> wrote in message news:... > VS2005 seems to be officially supported. Here's part of the readme file > in the PCBuild8 directory in the Python 2.5 source. > > " > Building Python using VC++ 8.0 > ---

Re: morning in Python

2008-05-18 Thread inhahe
What advantages do teams have? in what? over who? when? If they have any use at all, what language is good for them? How do programming teams interact? It sounds fun. I'm not sure I want to get work done so much as talk, but programming is fun. -the advantages of teams in general is the organi

Re: morning in Python

2008-05-18 Thread inhahe
By the way, "state" as a meronym of "city" and "state" as it applies to programming (i.e. stasis) are two unrelated things. >I'd start to discuss state property in appertanance to city >property. >What are some properties of the state? -- http://mail.python.org/mailman/listinfo/python-list

Re: morning in Python

2008-05-18 Thread inhahe
>It is not clear that the first (cheapest best) human->computer language >is a computer language, though if two were orthonormal >in comparison >to life, Python's fine. Not my first. The utterly dry, closed, logical, definitive, hierarchical, consistent, determinate nature of a computer languag

Re: morning in Python

2008-05-18 Thread inhahe
"inhahe" <[EMAIL PROTECTED]> wrote in message news:... > >>It is not clear that the first (cheapest best) human->computer language >>is a computer language, though if two were orthonormal >in comparison >>to life, Python's fine. Not my first.

Re: morning in Python

2008-05-18 Thread inhahe
> My ideal language would be a natively compiling cross between C++ and > Python. Objects declared with a type would be statically typed, objects > not declared with a type would be dynamically typed. There would also be > keywords to declare that class names won't be reassigned and class > a

Re: how would you...?

2008-05-18 Thread inhahe
"Sanoski" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I'm pretty new to programming. I've just been studying a few weeks off > and on. I know a little, and I'm learning as I go. Programming is so > much fun! I really wish I would have gotten into it years ago, but > here's my qu

Re: explain this function to me, lambda confusion

2008-05-18 Thread inhahe
> > Both the responses offer lambda free alternatives. That's fine, and > given the terse documentation and problems that I had understanding > them, I would agree. So what applications are lambdas suited to? I > think the parameterised function model is one. > What else? i've hardly ever used lam

Re: Compress a string

2008-05-18 Thread inhahe
i see lots of neat one-liner solutions but just for the sake of argument: def compress_str(str): new_str = "" lc = "" for c in str: if c != lc: new_str.append(c) return new_str "Matt Porter" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi guys, > > I

Re: Compress a string

2008-05-18 Thread inhahe
I forgot a line that says, "lc = c" i should really test my stuff. "inhahe" <[EMAIL PROTECTED]> wrote in message news:... >i see lots of neat one-liner solutions but just for the sake of argument: > > def compress_str(str): > new_str = "" >

Re: persistent deque

2008-05-20 Thread inhahe
"castironpi" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I'd like a persistent deque, such that the instance operations all > commit atomicly to file system. ok, i made your persistent deque. but there are two important notes regarding this module: 1) I am a genius. 2) it do

Re: persistent deque

2008-05-20 Thread inhahe
def __init__(self, filename, initial): should be def __init__(self, filename, initial=[]): (that was the whole reason i put the filename first.) sorry. -- http://mail.python.org/mailman/listinfo/python-list

Re: persistent deque

2008-05-20 Thread inhahe
TED]> wrote in message news:[EMAIL PROTECTED] > inhahe wrote: >> def __init__(self, filename, initial): >> >> should be >> >> def __init__(self, filename, initial=[]): >> >> (that was the whole reason i put the filename first.) >> >>

Re: Removing Space and "-" from a string

2008-05-20 Thread inhahe
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Shakir, > >> I have thousands of records in MS Access database table, which records I >> am fetching using python script. One of the columns having string like >> '8 58-2155-58' >> >> Desired output: '858215558' >> >> I want to remove

Re: persistent deque

2008-05-20 Thread inhahe
> > i don't know how i would get around the problem, though, because i'd have > to know how to access the deque object that my class stores when i do > deque.__init__ in my constructor, so that i could pickle it and my class > variables separately. > > i decided i could just pickle deque(self),

Re: Running programs under a python program...

2008-05-21 Thread inhahe
maybe you could instead of killing the program stop the loop that starts new processes and start one that runs until the last process ends? also, if you killed the program but stdout was still set to fd and stderr was still set to subprocesses.STDOUT, what would happen when those two objects d

Re: about python modules

2008-05-21 Thread inhahe
i always just put most of my python files in the c:\python25 directory. including ones i want to import as modules, since they import from there. otherwise you can put the file in c:\python25\lib\site-packages "srinivas" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > hi friends i

Re: C-like assignment expression?

2008-05-21 Thread inhahe
one of the few things i miss from C is being able to use assignment in expressions. that's the only thing, really. also there's no switch/case, you have to use a dictionary of functions instead, although i rarely need that, usually i just use elif. <[EMAIL PROTECTED]> wrote in message news:[E

Re: compressing short strings?

2008-05-21 Thread inhahe
i don't see anybody mentioning huffman encoding. i think it just works per byte, so it's not as tight as gzip or whatever. but it sounds like it would be easy to implement and wouldn't require any corpus-wide compression information. except a character frequency count if you wanted to be optim

Re: C-like assignment expression?

2008-05-21 Thread inhahe
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On May 21, 4:57 pm, "inhahe" <[EMAIL PROTECTED]> wrote: >> one of the few things i miss from C is being able to use assignment in >> expressions. that's the only thing, really. >>

Re: C-like assignment expression?

2008-05-21 Thread inhahe
>> >> One thing I hate from C is the assignment in expressions...Forcing >> myself to write >> 0 == Something >> rather than >> Something == 0 > > interesting trick, i've never thought of that/seen it > although if Python implemented it I think it should default to giving > warnings when you use =

Re: persistent deque

2008-05-21 Thread inhahe
something randomly made me realize why my second solution didn't work, so i fixed it. now you have a working persistent deque. 1. if you call somepdequeobject.load(filename) (as opposed to pdeque.load(filename)), do you want it to return a new object that it loaded from file, or do you want it

Re: persistent deque version 4

2008-05-22 Thread inhahe
"inhahe" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > 4. can someone tell me if the way i'm using the decorator is sane? i've > never used decorators before. it just seems ridiculous to a) define a > lambda that just throws away the

Re: conventions/requirements for 'is' vs '==', 'not vs '!=', etc

2008-05-22 Thread inhahe
>Ma: Symbolic identity is a mathematical relation >Mb: Symbols are acausal >m: Matter is causal >C: Symbolic identity is not defined on matter. What is defined on matter then? You're saying all symbolism is not defined on matter. Much of our thinking about the world itself is symbolic. How do

Re: conventions/requirements for 'is' vs '==', 'not vs '!=', etc

2008-05-22 Thread inhahe
"inhahe" <[EMAIL PROTECTED]> wrote in message news:... > >Ma: Symbolic identity is a mathematical relation >>Mb: Symbols are acausal >>m: Matter is causal >>C: Symbolic identity is not defined on matter. > I do think though that a computer languages c

Re: conventions/requirements for 'is' vs '==', 'not vs '!=', etc

2008-05-22 Thread inhahe
"inhahe" <[EMAIL PROTECTED]> wrote in message news:... > > "inhahe" <[EMAIL PROTECTED]> wrote in message news:... >> >Ma: Symbolic identity is a mathematical relation >>>Mb: Symbols are acausal >>>m: Matter is causal >>>C:

Re: Why is math.pi slightly wrong?

2008-05-22 Thread inhahe
"Dutton, Sam" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I've noticed that the value of math.pi -- just entering it at the > interactive prompt -- is returned as 3.1415926535897931, whereas (as every > pi-obsessive knows) the value is 3.1415926535897932... (Note the 2 at the

Re: Why is math.pi slightly wrong?

2008-05-22 Thread inhahe
"Dutton, Sam" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I've noticed that the value of math.pi -- just entering it at the > interactive prompt -- is returned as 3.1415926535897931, whereas (as every > pi-obsessive knows) the value is 3.1415926535897932... (Note the 2 at the

Re: Python is slow

2008-05-22 Thread inhahe
I don't get what the issue is between sites that use Python and being slow, if there is one, because there's a website online that shows the results of a dozen or so benchmarks when comparing any two languages. Python beats PHP in almost all the benchmarks. (it also beats almost all the other

Re: import X vs from x import *

2008-05-22 Thread inhahe
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > import Tkinter > from Tkinter import * > > i have a program where if i comment out either of those import- > statements i get an error. > > i thought they meant the same thing and from was supposed to be just > to imort just a specific

Re: Returning to 'try' block after catching an exception

2008-05-22 Thread inhahe
Might have a stack overflow issue, if it retries too many times? "alex23" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On May 22, 6:15 pm, Karlo Lozovina <[EMAIL PROTECTED]> wrote: >> Because when you expect exception to occur on something like 0.01% of >> cases, and you have 4 o

Re: Producing multiple items in a list comprehension

2008-05-22 Thread inhahe
"Joel Koltner" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Is there an easy way to get a list comprehension to produce a flat list > of, say, [x,2*x] for each input argument? > > E.g., I'd like to do something like: > > [ [x,2*x] for x in range(4) ] > > ...and receive > > [ 0,0

Re: php vs python

2008-05-22 Thread inhahe
I don't like php. I tried it once and I had it sort a list, but the list was apparently too long for its sorting function because it just sorted the first so-many elements of it and left the rest in order, and didn't generate any error. I like a language that's actually determined by what you

Re: Overloading __getitem__

2008-05-22 Thread inhahe
it seems like you can't do it exactly the way you're trying but you could do this def __getitem__(*args): if len(args) > 1 and args[1]: return self.get(args[0]) * 5 return self.get(args[0]) then you would use it like print foo['a'] print foo['a',True] or even print foo['a',"crazy"] if you

Re: Overloading __getitem__

2008-05-22 Thread inhahe
"inhahe" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > crazy = True > print foo['a',crazy] > just to clarify, you could use it like: crazy = "I'm crazy" #this only has to be done once print foo['a']

Re: Overloading __getitem__

2008-05-22 Thread inhahe
actually i ddin't think about the fact that you're overloading dict, which can already take multiple values in getitem so how about class crazy: pass and then in your dict class: def __getitem__(*args): if args[-1] is crazy: return self.get(args[:-1])*5 else: return self.get(args)

Re: Overloading __getitem__

2008-05-22 Thread inhahe
> Apparently, args already is a tuple, so this should be: > > def __getitem__(self, args): > > Is this documented somewhere? I couldn't find it anywhere. > Don't know, I just assumed it would take multiple arguments because I knew I had seen the form d[1,2] before, which incidentally is equival

Re: call f(a, *b) with f(*a, **b) ?

2008-05-22 Thread inhahe
"bukzor" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > This question seems easy but I can't figure it out. > Lets say there's a function: > > def f(a, *args): >print a >for b in args: print b > > and elsewhere in your program you have a list and a dict like this: > args =

Re: call f(a, *b) with f(*a, **b) ?

2008-05-22 Thread inhahe
>> 1 >> 2 actually, you don't want it to print 3 also? if not, then you would do f(*map(kwargs.get, inspect.getargspec(f)[0])+args[:1]) > import inspect > f(*map(kwargs.get, inspect.getargspec(f)[0])+args) > -- http://mail.python.org/mailman/listinfo/python-list

Re: php vs python

2008-05-22 Thread inhahe
> PHP can do that. There are also a number of templating engines > available. The nice thing about PHP is you have a choice. i just meant that php is sort of invented to combine html and code, so if you use python instead you should use a templating engine. but i suppose it's useful for php

Re: Python is slow

2008-05-23 Thread inhahe
"Bruno Desthuilliers" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Brad a écrit : >> cm_gui wrote: >>> Python is slow. >> >> It ain't C++, but it ain't a punch card either... somewhere in between. I >> find it suitable for lots of stuff. I use C++ when performance really >> ma

Re: call f(a, *b) with f(*a, **b) ?

2008-05-23 Thread inhahe
"Nick Craig-Wood" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > bukzor <[EMAIL PROTECTED]> wrote: >> That does, in fact work. Thanks! I'm a little sad that there's no >> builtin way to do it, owell. >> >> >>> def f(a, *args): >> ... print a >> ... for b in args: print

Re: call f(a, *b) with f(*a, **b) ?

2008-05-23 Thread inhahe
"inhahe" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > if we assume the constraints are that: > 1.he has list, l > 2.he has a dictionary, d > 3.he wants the function to print the values in the dictionary according to > a specific order of their

Re: Relationship between GUI and logic?

2008-05-23 Thread inhahe
> >> To be more specific, let's say I want to create a simple, 2D strategy >> game. It will have a board layout like chess or checkers and the player >> will move around the board. Let's say this is all I know, and perhaps I >> don't even know *this* for sure either. Is it possible to write the >>

Re: call f(a, *b) with f(*a, **b) ?

2008-05-23 Thread inhahe
" I wish this worked: >>> def main(a,b,*argv): pass >>> options['argv'] = argv >>> main(**options) TypeError: main() got an unexpected keyword argument 'argv' " - I was thinking about that exact same thing actually. Except that I was thinking you might want it like this, otherwise it could be

Re: Why is math.pi slightly wrong?

2008-05-23 Thread inhahe
""" "Dutton, Sam" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Thanks for all the answers and comments. >math.pi is exactly equal to 884279719003555/281474976710656, which is the >closest C double to the actual value of pi So much for poor old 22/7... Sam """ The biblically cor

Re: Python is slow

2008-05-23 Thread inhahe
"Paul Rubin" <http://[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > "inhahe" <[EMAIL PROTECTED]> writes: >> planets are spherical (all implementations of Python are not natively >> compiled (and you said for whatever definition)), a

Re: Problem with py2exe

2008-05-28 Thread inhahe
i used py2exe with python 2.5 and it worked fine just the other day. py2exe-0.6.6.win32-py2.5.exe was the download filename. <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Dear Members of the group, > py2exe does not seem to be integrating with 2.5 or later versions. > I was tryin

Re: question

2008-05-30 Thread inhahe
"Gandalf" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On May 30, 12:14 am, John Henderson <[EMAIL PROTECTED]> wrote: >> Gandalf wrote: >> > how do i write this code in order for python to understand it >> > and print me the x variable >> >> > x=1 >> > def (): >> > x++ >>

How to import filenames with special characters?

2008-06-24 Thread inhahe
How would I import a python file whose name contains characters like .'s or !'s? Is there really _no_ way to do that? I have to use plain jane letters and numbers for everything? -- http://mail.python.org/mailman/listinfo/python-list

  1   2   >