Re: Point and click GUI builder for Python
Madhusudan Singh wrote: > Is there such a thing for python ? Like Qt Designer for instance ? The easiest way to create Python GUI apps: PythonCard. It is based on wxPython by it has a higher level of abstraction. You just drag and drop widgets on a form and code the events like you woud in Visual Basic or Delphi. IMHO, it's easier, simpler, more intuitive and stable than Boa Constructor. -- http://mail.python.org/mailman/listinfo/python-list
Re: How to check if a string "is" an int?
Can't we just check if the string has digits? For example: >>> x = '15' >>> if x.isdigit(): print int(x)*3 45 >>> -- http://mail.python.org/mailman/listinfo/python-list
C# equivalent to range()
I'm sorry for asking about another language here, but since I only know Python and I'm trying to write something in C#, I guess this is the best place... I'd like to know how to write this in C#: x=[] sz = 1000 x.extend(range(sz)) My question is about "range" and "extend". Is there any equivalent in C#? Thanks in advance, Neuruss -- http://mail.python.org/mailman/listinfo/python-list
Re: C# equivalent to range()
John Machin wrote: > Neuruss wrote: > > I'm sorry for asking about another language here, but since I only know > > Python and I'm trying to write something in C#, I guess this is the > > best place... > > > > Bad guess. Ask questions about language X on comp.lang.X Well, perhaps I should. And I should also explain how range and extend work in python, which is almost the same thing... I thougt that maybe some python programmer could have experience here with c# and give me a little hint. But unfortunately, there are people here who are not willing to waste their time helping, but enjoy to waste their time niggling... Thanks anyway! Neuruss -- http://mail.python.org/mailman/listinfo/python-list
Re: C# equivalent to range()
Thank you DH!!
D H wrote:
> Neuruss wrote:
> > I'm sorry for asking about another language here, but since I only know
> > Python and I'm trying to write something in C#, I guess this is the
> > best place...
> >
> > I'd like to know how to write this in C#:
> >
> > x=[]
> > sz = 1000
> > x.extend(range(sz))
> >
> > My question is about "range" and "extend". Is there any equivalent in
> > C#?
> >
> > Thanks in advance,
> > Neuruss
> >
>
> List mylist = new List();
> for (int i=0; i<1000; i++)
> {
> mylist.Add(i);
> }
>
> You can use AddRange, C# 2.0 anonymous delegates, IEnumerable, yield,
> foreach, and so forth instead, but for your example this is simplest.
>
> Another option is to use boo. http://boo.codehaus.org/
> It uses python's syntax but is as fast as C#. The only change you'd
> have to make in that code is to capitalize the Extend method call.
--
http://mail.python.org/mailman/listinfo/python-list
Re: C# equivalent to range()
Delaney, Timothy (Tim) wrote: > Well, there are reasons to reply to a message stating that it's not on-topic > for the group. The most common reaction to receiving no replies is to start a > new thread petulantly asking why there were no answers to the original > thread. If that one gets no replies the most common reaction is start another > new thread stating that Python sucks, the newsgroup sucks, etc. > > Not saying that this is what would have happened in this case, but it is the > most common sequence of events. Better to head it off before it happens. At > least any upset replies tend to be restricted to the one thread ;) > > Unfortunately, posting a good response, whilst apparently helpful, tends to > encourage further off-topic postings :( > > Tim Delaney Tim, I don't think it was entirely off topic, although I understand your point. It happens that I'm using Ironpython, and I wanted to improve the performance of a script by writing a c# extension. Writing extensions in other languages (c, c++ and now c#) is a common practice amongst python programers, and that was the purpose of my question. I asked especifically the equivalence of a couple of python features in this language. And I did it here, because chances were that someone would understand what I was asking, (which was how to translate those python features into another language). I could have asked this question in a c# related forum, but then I should have had to explain how "range" and "extend" work in python... Actualy, someone replied with a couple of lines, and this was just what I wanted! That person was very kind and I'm sure it didn't take more than a few seconds to write his reply. I'm sure he was satisfied by helping me, and I was satisfied too by his kind reply. What about the others? Are they worried about the storage limit of this forum perhaps? Or it was the wasted bandwidth? What was exactly the reason for being that annoyed? Am I forcing them to read my question or to post a reply? I grant that perhaps I should have explained why I needed this advice. But I'm not using this forum to learn another thing. I am a (budding) python programmer looking for a solution, and my question was very especific and to the point. Anyway, if someone still feels that the question is off topic, there are better ways to point it out (as you're doing now). If these people's life suck, I suggest they buy a punching bag to discharge their frustation. I don't think this forum is the best place for doing it. Regards, Neuruss -- http://mail.python.org/mailman/listinfo/python-list
Re: C# equivalent to range()
Dennis Lee Bieber wrote: > What most of us saw was a blunt request on how to implement a Python > construct in some other language that may not be familiar to us. I'm curious, who are "us"? -- http://mail.python.org/mailman/listinfo/python-list
Re: C# equivalent to range()
Erik Max Francis wrote: > > I'm curious, who are "us"? > > The regular readers of comp.lang.python. If you don't think we haven't > seen this a zillion times before, you're kidding yourself. > > If you want help on a language, ask in that language's newsgroup/mailing > list/forum/whatever. > > It surprises me how often people don't ask useful questions, or > deliberately and knowingly ask questions in the wrong places, and then > actually _defend_ their actions after they're politely but firmly > informed how to fix the problem. You're really not making yourself look > any better by continuing this thread ... Just to finish this thread: 1) It wasn't a blunt question. I started the post apologizing for the (not entirely) off opic question. 2) I wasn't politely informed. It was pretty harshly. 3) If you mean that "us" are the zillion registered users of this mailing list, well buddy, you know a whole lot of people! 4) At least one of these people replied kindly and correctly to my question within seconds. Three of four more spent several minutes whining. The other zilion persons who were not interested (other than the four I mentioned above) silently and peacefully ignored the question on went on with their happy lifes. À bientôt, Neuruss -- http://mail.python.org/mailman/listinfo/python-list
Re: C# equivalent to range()
Fredrik Lundh wrote: > do you think the few of us who haven't already done so would miss > anything if we plonked you now? Oh, no... How am I supposed to live without you, Freddie? -- http://mail.python.org/mailman/listinfo/python-list
installing mod_python with python 2.4 on Windows xp
I need help with this issue. All my attempts to get it up and running failed, and the documentation I found so far didn't help me at all. I'm trying to configure this components together: - Apache 2.0.53 - mod_python 3.2.0 dev 2005 0428 win32-p v2.4 - python 2.4 The above version of mod_python binary is the most up to date I could get, but I don't know how stable it is. I'd like to know if anyone succeded installing mod_python and, if so, what configuration used in httpd.conf. Any information would be highly appreciated... Thanks! LUIS -- http://mail.python.org/mailman/listinfo/python-list
Re: Learning more about "The Python Way"
> As someone else mentioned, get a copy of the 2nd edition of the Python > Cookbook. It's full of gold. Or you can read the recipes online here: http://aspn.activestate.com/ASPN/Python/Cookbook/ -- http://mail.python.org/mailman/listinfo/python-list
Re: unladen swallow: python and llvm
On 5 jun, 06:29, Nick Craig-Wood wrote: > Luis M González wrote: > > > I am very excited by this project (as well as by pypy) and I read all > > their plan, which looks quite practical and impressive. > > But I must confess that I can't understand why LLVM is so great for > > python and why it will make a difference. > > CPython uses a C compiler to compile the python code (written in C) > into native machine code. > > unladen-swallow uses an llvm-specific C compiler to compile the CPython > code (written in C) into LLVM opcodes. > > The LLVM virtual machine executes those LLVM opcodes. The LLVM > virtual machine also has a JIT (just in time compiler) which converts > the LLVM op-codes into native machine code. > > So both CPython and unladen-swallow compile C code into native machine > code in different ways. > > So why use LLVM? This enables unladen swallow to modify the python > virtual machine to target LLVM instead of the python vm opcodes. > These can then be run using the LLVM JIT as native machine code and > hence run all python code much faster. > > The unladen swallow team have a lot more ideas for optimisations, but > this seems to be the main one. > > It is an interesting idea for a number of reasons, the main one as far > as I'm concerned is that it is more of a port of CPython to a new > architecture than a complete re-invention of python (like PyPy / > IronPython / jython) so stands a chance of being merged back into > CPython. > > -- > Nick Craig-Wood --http://www.craig-wood.com/nick Thanks Nick, ok, let me see if I got it: The Python vm is written in c, and generates its own bitecodes which in turn get translated to machine code (one at a time). Unladen Swallow aims to replace this vm by one compiled with the llvm compiler, which I guess will generate different bytecodes, and in addition, supplies a jit for free. Is that correct? It's confussing to think about a compiler which is also a virtual machine, which also has a jit... Another thing that I don't understand is about the "upfront" compilation. Actually, the project plan doesn't mention it, but I read a comment on pypy's blog about a pycon presentation, where they said it would be upfront compilation (?). What does it mean? I guess it has nothing to do with the v8 strategy, because unladen swallow will be a virtual machine, while v8 compiles everything to machine code on the first run. But I still wonder what this mean and how this is different. By the way, I already posted a couple of question on unladen's site. But now I see the discussion is way to "low level" for me, and I wouldn't want to interrupt with my silly basic questions... Luis -- http://mail.python.org/mailman/listinfo/python-list
Re: Converting Python code to C/C++
On 23 jun, 12:49, Kurt Smith wrote: > On Mon, Jun 22, 2009 at 9:49 PM, Andras > > > > > > Pikler wrote: > > Hi! > > > Short: I need to turn a Python program that I (mostly) wrote into C code, > > and I am at a loss. > > > Long: I’m doing research/programming for a professor, and we are working > > with MIDI files (a type of simple music file). The research deals with > > generating variations from a musical melody; currently, my Python code uses > > a Python midi package I found online to read the notes in question from a > > midi file, about 350 lines of my own code to generate a variation based on > > these notes and the professor’s algorithms, and finally the package again to > > write the new melody to another midi file. > > > Now, my professor would like to have this exact code in C/C++, as she > > believes C is more compatible with MATLAB, and wants the code to be > > available in multiple languages in case a programmer works for her in the > > future who knows C but not Python. While I know a tiny bit of C (emphasis on > > the tiny), I would much prefer if there were some sort of automatic compiler > > I could use to turn my Python code into C than taking a week or two or three > > to learn the minimum I need about C, find a way to access MIDI files in it, > > and rewrite all of my code. > > > After some googling, I found and tried Shedskin, but it doesn’t work, as the > > Python midi package I’m using uses modules which Shedskin does not support. > > Otherwise, I haven’t found much. Is there anything out there to help me do > > this? If not, from anyone who has experience in this regard, how daunting > > should I expect this to be? > > Taking on C from a cold start and being able to handle the ins and > outs of interfacing with Python isn't something that's feasible in > 'two or three weeks'. Here are a couple of options -- take 'em or > leave 'em: > > 1) Put the code in Cython:http://www.cython.org/ (full disclosure: > I'm doing a GSoC project with Cython). It will convert pretty much > any python code into C code (even closures are supported in the most > recent version, I think), and the C code can then be compiled into an > extension module. > > The only problem with the above is the C code isn't, at first blush, > easy to read. Nor is it supposed to be changed by the user. So that > leads us to option... > > 2) Write the core functionality in C yourself, and then wrap those C > functions in Cython. You'll want to take a look at the documentation: > > http://docs.cython.org/ > > and, more specifically on wrapping C code: > > http://docs.cython.org/docs/external_C_code.html > > I don't think you'll be able to avoid learning C, though. > > Kurt There's another (very good) option: Try shedskin http://code.google.com/p/shedskin/ . Shedskin can compile a whole program or part of it as an extension module. It translates python code to c++ and compiles it. The good thing is that you don't have to know anything about c or c++. You simply have to restrict your coding style a little bit to make it explicitly static. For example: if you declare a = 5, that means that "a" is an integer, so you cannot then change it to a string (a = "hello", won't work). Luis -- http://mail.python.org/mailman/listinfo/python-list
Re: ANN: psyco V2
It seems psyco.org is still in the transfer process... Is there any charitable soul with a link to a Windows binary? :-) -- http://mail.python.org/mailman/listinfo/python-list
Re: Python for professsional Windows GUI apps?
On 26 ago, 05:29, erikj wrote: > Hi, > > You could have a look at Camelot, to see if it fits > your needs :http://www.conceptive.be/projects/camelot/ > > it was developed with cross platform business apps in > mind. when developing Camelot, we tried to build it using > wxWidgets first (because of the licensing at that time), > but it turned out that developing with QT proved to be > much more straightforward. QT is documented very well > and you seldom encounter 'strange' issues that cost hours > of time to pinpoint and fix. > > the datagrid was developed to be able to handle millions > of database records without glitches and is flexible thanks > to QT's model-view-delegate framework. > > we do print barcodes with this app (even directly to > zebra printers) > > if you have questions regarding Camelot, please feel free > to post on our mailing list :http://groups.google.com/group/project-camelot > > Regards, > > Erik > > On Aug 24, 2:08 pm, Gilles Ganault wrote: > > > > > Hello > > > I was wondering if some people in this ng use Python and someGUI > > toolkit (PyWin32, wxWidgets, QT, etc.) to build professional > > applications, and if yes, what it's like, the pros and cons, etc. > > > I'm especially concerned about the lack of controls, the lack of > > updates (lots of controls in wxWidgets are 1.0 deadware), and problems > > linked to how to update users' PC remotely when I build a new version > > using eg. Py2exe. > > > I need controls for business apps like access to databases, good data > > grid, printing reports (with or without barcodes), etc. > > > Thank you. Looks interesting, but I wonder if I can use Camelot without its ORM. I feel that ORMs make easy things easier, but complex things much harder... Can I use it with plain old sql? Luis -- http://mail.python.org/mailman/listinfo/python-list
