Re: python for irc client

2024-07-04 Thread inhahe via Python-list
On Thu, Jul 4, 2024 at 5:22 AM inhahe wrote: > > > On Thu, Jul 4, 2024 at 5:14 AM Daniel via Python-list < > python-list@python.org> wrote: > >> >> In your wisdom, would python be a good environment to accomplish this? > > > I think Python would be

Re: python for irc client

2024-07-04 Thread inhahe via Python-list
On Thu, Jul 4, 2024 at 5:14 AM Daniel via Python-list < python-list@python.org> wrote: > Hi guys - > > I have historical experience developing sofwtare for my own use. It has > been > quite a while since doing so and the advent of new languages has brought me > here. Python has built quite a reput

Re: xkcd.com/353 ( Flying with Python )

2024-04-01 Thread inhahe via Python-list
On Mon, Apr 1, 2024 at 1:26 PM HenHanna via Python-list < python-list@python.org> wrote: > Johanne Fairchild wrote: > > > HenHanna writes: > > >> https://xkcd.com/1306/ > >> what does SIGIL mean? > > > A glyph used in magic. Or, for Perl, the symbol in front of a var

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: 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: 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: 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: 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

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: 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

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: 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

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

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: 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: 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: 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

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 < sathvikveliga...@gmail.com> 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: 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

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: phyton

2019-09-10 Thread inhahe
On Tue, Sep 10, 2019 at 8:41 AM Pankaj Jangid wrote: > tim.g...@quicknet.nl 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
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 < > python-list@python.org> wrote: > >> Op dinsdag 10 september 2019 13:03:46 UTC+2 schreef tim...@quicknet.nl: >> > Hi everybody, >> > &

Re: phyton

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

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: 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: 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: 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

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

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: -

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'

trying to use sdl_pango with python

2010-08-22 Thread inhahe
i'm new to ctypes. can someone help me use sdl_pango with python? here's the documentation: http://sdlpango.sourceforge.net/ here's my code: - import pygame from ctypes import * import win32api MATRIX_TRANSPARENT_BACK_WHITE_LETTER = c_char_p("

Re: struct pointing to another struct?

2010-08-13 Thread inhahe
On Aug 13, 4:07 pm, Peter Otten <__pete...@web.de> wrote: > inhahe wrote: > > say i have this definition: > > >    1 typedef struct SDL_Surface { > >    2     Uint32 flags;                           /* Read-only */ > >    3     SDL_PixelFormat *format;    

struct pointing to another struct?

2010-08-13 Thread inhahe
say i have this definition: 1 typedef struct SDL_Surface { 2 Uint32 flags; /* Read-only */ 3 SDL_PixelFormat *format;/* Read-only */ 4 int w, h; /* Read-only */ 5 Uint16 pitch;

Re: I think I found a bug in Python 2.6.4 (in the inspect module)

2009-12-29 Thread inhahe
On Tue, Dec 29, 2009 at 6:38 PM, Irmen de Jong wrote: > On 29-12-2009 23:22, inhahe wrote: > > inspect.getargvalues is used on frames, not on regular code objects. > Maybe you were looking for inspect.getargspec? > That explains it! I knew I'd done this before, I was just

Re: I think I found a bug in Python 2.6.4 (in the inspect module)

2009-12-29 Thread inhahe
On Tue, Dec 29, 2009 at 5:11 PM, inhahe wrote: > On Tue, Dec 29, 2009 at 5:10 PM, inhahe wrote: >> >> So i'm guessing that the attribute has been changed from func_code to >> f_code but the inspect module wasn't updated to reflect that. >> > > er

Re: I think I found a bug in Python 2.6.4 (in the inspect module)

2009-12-29 Thread inhahe
On Tue, Dec 29, 2009 at 5:10 PM, inhahe wrote: > > So i'm guessing that the attribute has been changed from func_code to > f_code but the inspect module wasn't updated to reflect that. > er i mean from f_code to func_code -- http://mail.python.org/mailman/listinfo/python-list

I think I found a bug in Python 2.6.4 (in the inspect module)

2009-12-29 Thread inhahe
Python 2.6.4 (r264:75708, Oct 26 2009, 08:23:19) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import inspect >>> def a(b=1): pass ... >>> inspect.getargvalues(a) Traceback (most recent call last): File "", line 1, in File "C:\P

Re: How to set object parameters nicely?

2009-12-03 Thread inhahe
On Thu, Dec 3, 2009 at 9:32 AM, inhahe wrote: > On Thu, Dec 3, 2009 at 9:16 AM, Lie Ryan wrote: >> On 12/2/2009 10:26 AM, allen.fowler wrote: >>> >>> I've tried this, but have found two issues: >>> >>> 1) I can't set default values. >

Re: How to set object parameters nicely?

2009-12-03 Thread inhahe
On Thu, Dec 3, 2009 at 9:16 AM, Lie Ryan wrote: > On 12/2/2009 10:26 AM, allen.fowler wrote: >> >> I've tried this, but have found two issues: >> >> 1) I can't set default values. >> 2) I can't set required values. >> >> In both of the above cases, if the object is created without the >> "exact" d

Re: Beginner Q. interrogate html object OR file search?

2009-12-02 Thread inhahe
or i guess you could go the middle-way and just use regex. people generally say don't use regex for html (regex can't do the nesting), but it's what i would do in this case. though i don't exactly understand the question, re the html file parsing script you say you have already, or how the date is

Re: Declaring a class level nested class?

2009-12-02 Thread inhahe
it seems to me like it should work just fine if you just take out the second line where it just says nestedClass On Wed, Dec 2, 2009 at 11:55 PM, cmckenzie wrote: > Hi. > > I'm new to Python, but I've managed to make some nice progress up to > this point. After some code refactoring, I ran into a

Re: semantics of ** (unexpected/inconsistent?)

2009-11-30 Thread inhahe
On Mon, Nov 30, 2009 at 2:05 PM, Lie Ryan wrote: > On 12/1/2009 5:58 AM, inhahe wrote: >> >> i wasn't suggesting it as a feature for python, just pointing out why >> it might seem counterintuitive. > > I'm interested, what do YOU (inhahe) think the result

Re: Completely OT

2009-11-30 Thread inhahe
On Mon, Nov 30, 2009 at 2:17 PM, Lie Ryan wrote: > On 12/1/2009 5:00 AM, inhahe wrote: >> >> On Mon, Nov 30, 2009 at 12:58 PM, inhahe  wrote: >>> >>> On Mon, Nov 30, 2009 at 12:49 PM, Victor Subervi >>>  wrote: >>>> >>>> >>

Re: semantics of ** (unexpected/inconsistent?)

2009-11-30 Thread inhahe
distinction explains the behavior, but I >>>> find it somewhat counter-intuitive. >>> >>> You shouldn't find it any more surprising than the fact that >>> >>>  a = 2 + 3 >>>  print a * 5 >>> >>> gives a different

Re: High-performance Python websites

2009-11-30 Thread inhahe
On Wed, Nov 25, 2009 at 7:33 PM, ShoqulKutlu wrote: > Hi, > > Managing load of high volume of visitors is a common issue for all > kind of web technologies. I mean this is not the python issue. This > issue is mostly about server level designs. You need to supply load > balancing for both web serv

Re: Completely OT

2009-11-30 Thread inhahe
On Mon, Nov 30, 2009 at 1:21 PM, Victor Subervi wrote: > On Mon, Nov 30, 2009 at 2:00 PM, inhahe wrote: >> >> On Mon, Nov 30, 2009 at 12:58 PM, inhahe wrote: >> > On Mon, Nov 30, 2009 at 12:49 PM, Victor Subervi >> > wrote: >> >> >> >&g

Re: Questions about list-creation

2009-11-30 Thread inhahe
list comprehensions, not generator comprehensions) i.e. notice that you can do this ''.join(x for x in ['a','b','c']) no list or [] involved - it's just a generator comprehension being passed to a function. On Mon, Nov 30, 2009 at 1:12 PM, inhahe wrote:

Re: Questions about list-creation

2009-11-30 Thread inhahe
On Mon, Nov 30, 2009 at 12:22 PM, Manuel Graune wrote: > > Hello, > > in (most) python documentation the syntax "list()" > and "[]" is treated as being more or less the same > thing. For example "help([])" and "help(list())" point > to the same documentation. Since there are at least > two cases w

Re: Completely OT

2009-11-30 Thread inhahe
On Mon, Nov 30, 2009 at 12:58 PM, inhahe wrote: > On Mon, Nov 30, 2009 at 12:49 PM, Victor Subervi > wrote: >> >> >> If I'm not mistaken, that won't help me actually print to screen the user's >> choices as he selects them, which in my application,

Re: Completely OT

2009-11-30 Thread inhahe
On Mon, Nov 30, 2009 at 12:49 PM, Victor Subervi wrote: > > > On Mon, Nov 30, 2009 at 1:39 PM, inhahe wrote: >> >> i'm pretty new to javascript programming, but i'm pretty sure you just >> need ajax, which AFAIK is a highly technical way of saying "u

Re: reading from a text file

2009-11-30 Thread inhahe
i don't understand the point of using 'with' but i don't understand what 'with' does at all i've tried to understand it a few times anyway here: import random result = random.choice(open("c:\\test.txt").readlines()) On Mon, Nov 30, 2009 at 10:41 AM, Tim Golden wrote: > Olof Bjarnason wrote: >> >

Re: Completely OT

2009-11-30 Thread inhahe
i'm pretty new to javascript programming, but i'm pretty sure you just need ajax, which AFAIK is a highly technical way of saying "using javascript in a way that makes web pages interactive" JSON afaik is a way of data to and from the server that allows for lists and more variable types and such, b

Re: problem with lambda / closures

2009-11-30 Thread inhahe
On Mon, Nov 30, 2009 at 10:54 AM, Benjamin Kaplan wrote: > > I don't know if anyone considers python's incomplete implementation of > closures a "feature" but it's documented so it's not really a bug > either. I believe there is a trick with default arguments to get this > to work, but I don't use

Re: New to python

2009-11-30 Thread inhahe
to put it simplistically it's a way of combining multiple variables into one for example, for a person you could have person.haircolor person.echnicity person.age etc. but you can then also manipulate 'person' as a whole like you would any other variable, such as x[n] = person a struct, as far a

Re: semantics of ** (unexpected/inconsistent?)

2009-11-30 Thread inhahe
one point of confusion could be the use of ** instead of superscript. it might make things a little bit more counterintuitive-looking than with superscripts, since the issue with would only apply to exponents, as -5*4 and a = -5 a*4 return the same answer, and superscripts make it a little eas

Re: semantics of ** (unexpected/inconsistent?)

2009-11-29 Thread inhahe
On Sun, Nov 29, 2009 at 8:04 PM, Esmail wrote: > Chris Rebert wrote: > Wow .. never heard of Concatenative_languages languages before or the > distinction you make. Your distinction explains the behavior, but I > find it somewhat counter-intuitive. (I use the Python interpreter frequently > for sm

Re: * for generic unpacking and not just for arguments?

2009-11-29 Thread inhahe
On Sun, Nov 29, 2009 at 10:40 AM, Mel wrote: > Russell Warren wrote: > >> Maybe it's just that * is strictly for arguments, and trying it for >> generic tuple unpacking is abuse (which is down the corridor in 12A). > > I'd agree with that.  It's a feature of function calls, not a feature of > sequ

Re: Number of distinct substrings of a string [continuation]

2009-11-29 Thread inhahe
On Sun, Nov 29, 2009 at 9:10 AM, n00m wrote: > > Even if Py by 4x *slower* -- it's still a perfect Ok for it (C# will > be > much (much) slower than Python). > > How do you figure? As far as I know C# is many, many times faster than Python. (i was disappointed to find out that even IronPython is

staticmethod not callable? (trying to make a Singleton metaclass..)

2009-11-29 Thread inhahe
I'm trying to come up with a system for singletons, where I don't have to modify anything for an individual class except to define __metaclass__ or, if possible, to inherit another class. I want it to raise an error if making a duplicate instance of a class is attempted, rather than to return the

Re: Arcane question regarding white space, editors, and code collapsing

2009-11-29 Thread inhahe
I had this same problem with an application called Notepad++, which is a shame because I like the way it works and it's nice and tight. Now I use Komodo Edit instead, which doesn't have that problem, and has all the features of Notepad++ but just isn't as fast. Also all the colors were awful, and

Re: Feature request: String-inferred names

2009-11-29 Thread inhahe
On Sun, Nov 29, 2009 at 5:15 AM, The Music Guy wrote: > Okay, I'm having a really hard time telling which messages are getting > on to the list and which ones aren't. Some of the messages I send show > up in the comp.lang.python mirror in Google Groups, and some aren't. > Others show up on the Gro

Re: Filling in a tuple from unknown size list

2009-11-29 Thread inhahe
On Sun, Nov 29, 2009 at 4:42 AM, inhahe wrote: > maybe that thing in python 3 that someone mentioned is the answer, but > otherwise i always think Python should admit something like this: > > a, b, c, *d = list > > i.e. if list were [1,2,3,4,5], you'd get a=1, b=2, c=3

Re: Filling in a tuple from unknown size list

2009-11-29 Thread inhahe
maybe that thing in python 3 that someone mentioned is the answer, but otherwise i always think Python should admit something like this: a, b, c, *d = list i.e. if list were [1,2,3,4,5], you'd get a=1, b=2, c=3, d=[4, 5] not that that solves the None problem, though i don't have any feature sugg

Re: Feature request: String-inferred names

2009-11-28 Thread inhahe
i like this idea (i posted some thoughts on it in the blog, but it's not approved yet as of this writing) in short, i suggested extending the idea to make it more a) generalized, b) simple, c) intuitive, and d) flexible. so instead of just using $ for attributes, you could use it anywhere you def

Re: The rap against "while True:" loops

2009-10-19 Thread inhahe
On Mon, Oct 19, 2009 at 1:55 PM, inhahe wrote: > > > On Sat, Oct 10, 2009 at 6:34 PM, Mensanator wrote: > >> On Oct 10, 5:02�pm, kj wrote: >> > In <01ccc46d-5ea9-4dfe-ba22-699c6b859...@v36g2000yqv.googlegroups.com> >> Mensanator writes: >> >

classes riddle

2009-10-19 Thread inhahe
Can somebody clear this up for me? -- Class B(A): def __init__(self, a) A.__init__(a) self.a = a a = A() ba = B(a) bc = B(a) bd = B(a) -- I'm not sure what A.__init__ here does. I would think its __init__ is designed specifically to run once for any given object.. so i'm not sure what happ

trouble with regex?

2009-10-08 Thread inhahe
Can someone tell me why this doesn't work? colorre = re.compile ('(' '^' '|' '(?:' '\x0b(?:10|11|12|13|14|15|0\\d|\\d)' '(?:' ',(?:10|11|12|13|1

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

Re: The Yield statement

2008-07-06 Thread inhahe
"Alex Bryan" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Okay, so i don't really understand the Yield thing and i know it is > useful. I've read a few things about it but it is all programming jargon > and so basically it is hard for me to understand. So can anyone give me a

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

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++ >>

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: 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: 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: 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
"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: 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: 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: 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: 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: 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: 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: 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
"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
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: 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: 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: 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: 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: 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: 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: 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: 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
>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: 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: 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: 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: 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. >>

  1   2   >