Re: Timezone in HH:MM Format

2024-06-18 Thread Ivan "Rambius" Ivanov via Python-list
Thank you all for your responses! On Tue, Jun 18, 2024 at 9:54 PM Jon Ribbens via Python-list wrote: > > datetime.now(ZoneInfo("America/New_York")).isoformat() Both .isoformat() and "%:z" work. -- Tangra Mega Rock: http://www.radiotangra.com -- https://mail.python.org/mailman/listinfo/python

Timezone in HH:MM Format

2024-06-18 Thread Ivan "Rambius" Ivanov via Python-list
ZoneInfo s = datetime.strftime(datetime.now(ZoneInfo("America/New_York")), "%Y-%m-%dT%H:%M:%S%z") print(s) This prints the same as the shell command above except the last column: 2024-06-18T19:28:56-0400 Any help will be appreciated. Regards Ivan -- Ta

Re: A Single Instance of an Object?

2024-03-11 Thread Ivan "Rambius" Ivanov via Python-list
On Mon, Mar 11, 2024 at 5:06 PM dn via Python-list wrote: > > Good question Rambius! > > On 12/03/24 09:53, Ivan "Rambius" Ivanov via Python-list wrote: > > Hello, > > > > I am refactoring some code and I would like to get rid of a global > >

Re: A Single Instance of an Object?

2024-03-11 Thread Ivan "Rambius" Ivanov via Python-list
On Mon, Mar 11, 2024 at 5:01 PM Chris Angelico via Python-list wrote: > > On Tue, 12 Mar 2024 at 07:54, Ivan "Rambius" Ivanov via Python-list > wrote: > > I am refactoring some code and I would like to get rid of a global > > variable. Here is the outline: > &

A Single Instance of an Object?

2024-03-11 Thread Ivan "Rambius" Ivanov via Python-list
Hello, I am refactoring some code and I would like to get rid of a global variable. Here is the outline: import subprocess CACHE = {} def lookup(key): Runs the command cmd, parses its output, extract's the key's value, caches it and returns it. If the key has already been in the cac

Re: Question about logging.config.dictConfig

2023-02-08 Thread Ivan "Rambius" Ivanov
On Tue, Feb 7, 2023 at 7:35 PM Peter J. Holzer wrote: > > On 2023-02-07 17:58:26 -0500, Ivan "Rambius" Ivanov wrote: > > I am trying to configure my loggers using dictConfig, but they do not > > print anything. Here are more details. > [...] > > from m

Question about logging.config.dictConfig

2023-02-07 Thread Ivan "Rambius" Ivanov
Hello, I am trying to configure my loggers using dictConfig, but they do not print anything. Here are more details. I have several python scripts that use a similar logging setup. I put the common configuration in a separate module myloggingconf.py: # myloggingconf.py import logging def configu

Re: Custom help format for a choice argparse argument

2023-01-27 Thread Ivan "Rambius" Ivanov
Hello Cameron, On Fri, Jan 27, 2023 at 4:45 PM Cameron Simpson wrote: > > On 27Jan2023 15:31, Ivan "Rambius" Ivanov > wrote: > >I am developing a script that accepts a time zone as an option. The > >time zone can be any from pytz.all_timezones. I have &

Re: Custom help format for a choice argparse argument

2023-01-27 Thread Ivan "Rambius" Ivanov
> print(“Invalid timezone”,file=sys.stderr) > This is what I use now. I still wonder if I can mold HelpFormatter to do what I want it to do. > … > > > > > From: Python-list on > behalf of Ivan "Rambius" Ivanov > Date: Frida

Custom help format for a choice argparse argument

2023-01-27 Thread Ivan "Rambius" Ivanov
Hello, I am developing a script that accepts a time zone as an option. The time zone can be any from pytz.all_timezones. I have def main(): parser = argparse.ArgumentParser() parser.add_argument("-z", "--zone", choices=pytz.all_timezones) args = parser.parse_args() print(args)

Resolving Weekday Schedules to Dates

2022-07-21 Thread Ivan "Rambius" Ivanov
Hello, Do you know of a library that resolves schedules like every Wednesday at 3:00pm to absolute time, that is return the datetime of the next occurrence? Regards rambius P.S. -- Tangra Mega Rock: http://www.radiotangra.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Concatenating a Hash to a String

2020-12-01 Thread Ivan "Rambius" Ivanov
Hello, Thank you all for your help. On Tue, Dec 1, 2020 at 1:38 PM MRAB wrote: > The bytes are all in the ASCII range, so you can convert it into a > string using .decode('ascii'). I utilized encode and decode string methods to convert from bytes to strings > And, of course, use parametrised qu

Re: Concatenating a Hash to a String

2020-11-30 Thread Ivan "Rambius" Ivanov
On Tue, Dec 1, 2020 at 12:39 AM Chris Angelico wrote: > Don't do this! DO NOT do this! Even if it might happen to work with a > base 64 encoded value, this is a terrible terrible bug just waiting to > happen. Instead, use *parameterized queries* and keep your SQL safe. OK. What are parameterized

Concatenating a Hash to a String

2020-11-30 Thread Ivan "Rambius" Ivanov
Hello, I want to store the hashes of strings in a database and I have problems generating the sql statements. I generate the hashes using hashlib and then convert it to base64 and I put the base64 representation in the sql. Here is the code: #!/usr/bin/env python3.8 import base64 import hashlib

Re: EnvironmentError

2020-11-20 Thread Ivan "Rambius" Ivanov
Hello, On Thu, Nov 19, 2020 at 1:56 PM Usman Musa wrote: > > When I try to install a package or upgrade pip, using pip install I got > this error massage. > WARNING: Retrying (Retry(total=4, connect=None, read=None, > redirect=None, status=None)) after connection broken by > 'SSLError(SSLCe

Re: answer not correct

2020-11-08 Thread Ivan "Rambius" Ivanov
Hello, First of all, remove the asterisks around the snippet, it makes it so hard to copy and paste your code. My answer is inlined. On Sun, Nov 8, 2020 at 2:28 PM Quentin Bock wrote: > > *def add(numbers):* > * total = 1* If this is your sum, you need to initialize it to zero: total = 0 > *

Re: Property for dataclass field with default value

2020-06-18 Thread Ivan Ivanyuk
On Thu, 18 Jun 2020 at 11:26, Peter Otten <__pete...@web.de> wrote: > > Ivan Ivanyuk wrote: > > > Hello All, > > > > I have some trouble using @dataclass together with @property decorator > > or property() function. > > > > From the documentat

Property for dataclass field with default value

2020-06-17 Thread Ivan Ivanyuk
nt): if z > 1: self._x = z else: raise ValueError c= Container(x=10) print(c) c= Container() print(c) output is: Container(x=10) Container(x=30) So, what I'm missing here? Is there some way to use field() or decorators to make property just work th

Re: System Beep?

2019-03-08 Thread Ivan "Rambius" Ivanov
Hello, On Fri, Mar 8, 2019, 3:19 PM Steve wrote: > = RESTART: C:\Gork\Med Insulin codes\MedReminder 127.py > = > Traceback (most recent call last): > File "C:\Gork\Med Insulin codes\MedReminder 127.py", line 13, in > > windsound.Beep #(frequency, duration) > NameE

Re: My Issues

2017-09-13 Thread ivan
it in there the first time. Ivan -- https://mail.python.org/mailman/listinfo/python-list

Re: what type of application implemented with python?

2017-04-15 Thread Ivan "Rambius" Ivanov
Hello, Python's own website contains a non-exhaustive list of applications implemeted in Python: https://www.python.org/about/apps/ Regards Rambius On Sat, Apr 15, 2017 at 4:13 PM, kondaiah sinha wrote: > what type of application implemented with python?...like by using java we can > implement

Re: Getting stdout and stderr from subprocess in correct order

2017-03-04 Thread Ivan "Rambius" Ivanov
Hello, Thank you all for your suggestions. I will see what will apply to my use case. Regards Rambius On Sat, Mar 4, 2017 at 5:37 PM, Piet van Oostrum wrote: > "Ivan \"Rambius\" Ivanov" writes: > >> Dear colleagues, >> >> I using subprocess module

Getting stdout and stderr from subprocess in correct order

2017-03-03 Thread Ivan "Rambius" Ivanov
Dear colleagues, I using subprocess module and I am wondering how I can get the output of the spawned process's stdout and stderr in the right order. Here are my sample programs: $ cat subprc.py import subprocess import sys f = 'hw.py' p = subprocess.run([sys.executable, f], stdout=subprocess.PI

Re: Confused with installing per-user in Windows

2016-11-06 Thread Ivan Pozdeev via Python-list
ke this behavior default or by a simple command line option? So that user can be instructed to type "py myscript [.py]" and it will JUST work, if the script is on existing PATH or in the per-user directory? I know about bdist_wininst and Windows specific install options, but

What is currently the recommended way to work with a distutils-based setup.py that requires compilation?

2016-11-06 Thread Ivan Pozdeev via Python-list
the command line each time, now can they? I also asked this at http://stackoverflow.com/q/40174932/648265 a couple of days ago (to no avail). -- Regards, Ivan -- https://mail.python.org/mailman/listinfo/python-list

Re: creating multiple python Django projects in Windows environment

2016-03-19 Thread Ivan Jankovic
Hi Reto. I understand that i need to run Django on a server. I have deployed projects to AWS (ubuntu) in the past. My main question is around how to tie it into the windows environment. Ivan On Mar 18, 2016 7:40 PM, Reto Brunner wrote: Well you can just put it on a proper server. In the

RE: How to reassign the value of the variable on runtime?

2015-08-29 Thread Ivan Evstegneev
:46 AM, Ivan Evstegneev wrote: > It looks like, when the module is loaded (imported) for the first > time, all the functions that are defined within it and using a global > varialbles as their defaults, they would keep the first value of this globals. That's correct. When you def

RE: How to reassign the value of the variable on runtime?

2015-08-27 Thread Ivan Evstegneev
8/27/2015 12:25 PM, Ivan Evstegneev wrote: >> Can some please (I mean very please) explain me how do I reassign > >"engine_object" and "meta_object" variables, so they would store(point > >to) a new connection objects of my database, while other functions >

How to reassign the value of the variable on runtime?

2015-08-27 Thread Ivan Evstegneev
* But in this case I have some warning about "shadowing" I can know that I shadow outerscope variables but how can I achieve my goal other way? Tried __init__.py and other 10-20 things but still stuck with it, I'm sure this is because the lack of experience. Hope my situation is clear enough ^_^ Tried my best. Again thanks a lot for a help. Ivan. -- https://mail.python.org/mailman/listinfo/python-list

RE: Function Defaults - avoiding unneccerary combinations of arguments at input

2015-03-26 Thread Ivan Evstegneev
nneccerary combinations of > arguments at input > > On Thu, 26 Mar 2015 04:43 am, Ivan Evstegneev wrote: > > > Hello all , > > > > > > Just a little question about function's default arguments. > > > > Let's say I have this function: > > >

RE: Function Defaults - avoiding unneccerary combinations of arguments at input

2015-03-25 Thread Ivan Evstegneev
of > arguments at input > > On Wed, 25 Mar 2015 21:50:40 +0200, Ivan Evstegneev wrote: > > > Hello again ^_^, > > > > Googled a bit, and found only one, a "ValueError" exception, but still > > don't understand how it should be implemented in my

RE: Function Defaults - avoiding unneccerary combinations of arguments at input

2015-03-25 Thread Ivan Evstegneev
print("No valid input! Please try again ...") .. some code here.. Or I'm just too optimistic ^_^? Thanks in advance, Ivan. > -Original Message- > From: Python-list [mailto:python-list- > bounces+webmailgroups=gmail@pyth

RE: Function Defaults - avoiding unneccerary combinations of arguments at input

2015-03-25 Thread Ivan Evstegneev
Hi Terry, Thanks for answer, I'll google these stdlib instances. Sincerely, Ivan. > -Original Message- > From: Python-list [mailto:python-list- > bounces+webmailgroups=gmail@python.org] On Behalf Of Terry Reedy > Sent: Wednesday, March 25, 2015 20:43 > To: py

Function Defaults - avoiding unneccerary combinations of arguments at input

2015-03-25 Thread Ivan Evstegneev
full" condition. What is the common accepted way to deal with such unwanted situations? Thanks a lot in advance, Ivan. -- https://mail.python.org/mailman/listinfo/python-list

Advice needed - Choosing appropriate GUI (IDE) and Data Visualization software (3D also)

2014-12-19 Thread Ivan Evstegneev
able for my purposes. I need to redefine a lot of things and build them from scratch. e. In general I think Python can handle all my needs Any advice will be highly appreciated. Sincerely, Ivan. -- https://mail.python.org/mailman/listinfo/python-list

Classes - "delegation" question.

2014-12-17 Thread Ivan Evstegneev
ent + bonus) (when self.person actually implies "Person") But why we don't use "self" argument in --> self.person.giveRaise(percent + bonus)? So it should look like --> self.person.giveRaise(self, percent + bonus)? Is it because of embedding "Person&quo

RE: Classes - converting external function to class's method.

2014-12-15 Thread Ivan Evstegneev
ce inheritance, and for operator overloading." I'm not pretending to be a "smartass" here, but as I can understand from the context: Classes are namespaces, but they also have an additional capabilities. BR, Ivan > -Original Message- &g

RE: Classes - converting external function to class's method.

2014-12-14 Thread Ivan Evstegneev
Python to code of function "uppername()" when it becomes class method (after using this command: rec.method = uppername) Never mind, you already answered it here: > This is almost equivalent to the following: > > class rec: > name = 

Classes - converting external function to class's method.

2014-12-14 Thread Ivan Evstegneev
ed. Why actually in instance "x" >>>x.method() can auto-assign an "x" to uppername() function argument, but it doesn't work in a class "rec" itself? So I need to write down an "obj" argument manually. Why '__self__' exists only in i

RE: Python Iterables struggling using map() built-in

2014-12-07 Thread Ivan Evstegneev
iling list too. ^_^ But, you was a bit faster. What a surprise. ))) ))) ))) Thanks a lot for your answer. Ivan. -Original Message- From: Python-list [mailto:python-list-bounces+webmailgroups=gmail@python.org] On Behalf Of Ned Batchelder Sent: Sunday, December 7, 2014 17:29 To: p

RE: Tuple of lists concatenation - function vs comprehension

2014-12-07 Thread Ivan Evstegneev
age- From: Shiyao Ma [mailto:i...@introo.me] Sent: Sunday, December 7, 2014 17:18 To: Ivan Evstegneev Cc: python-list@python.org Subject: Re: Tuple of lists concatenation - function vs comprehension On 12/07, Ivan Evstegneev wrote: > Hello, > > When I have worked in Python shell (IDL

Tuple of lists concatenation - function vs comprehension

2014-12-07 Thread Ivan Evstegneev
[1, 2, 3, 4, 5, 6] The question is why I'm getting empty list while working with comprehension in interactive console? Thanks for your help. Ivan. -- https://mail.python.org/mailman/listinfo/python-list

Python Iterables struggling using map() built-in

2014-12-07 Thread Ivan Evstegneev
This is kind of a "dirty trick", because author do not talk about this anywhere. 3. The last question Author says: " But it falls into an infinite loop and fails in Python 3.X, because the 3.X map returns a one-shot iterable object instead of a list as in 2.X. In 3.X, as soon as we've run the list comprehension inside the loop once, iters will be exhausted but still True. To make this work in 3.X, we need to use the list built-in function to create an object that can support multiple iterations". (Like:"Wat?!" ^_^) Why the infinite loop would be there and why should list() to make it finite? o_0 Hope you have not get annoyed too much. Thanks in advance, Ivan -- https://mail.python.org/mailman/listinfo/python-list

RE: Comprehension with two variables - explanation needed

2014-11-23 Thread Ivan Evstegneev
Got the main idea. Still need to "chew it up" in depth. (As I mentioned I'm a beginner EE student, so please excuse me for my "lameness" ^_^) -Original Message- From: Python-list [mailto:python-list-bounces+webmailgroups=gmail@python.org] On Behalf Of Rustom Mody Sent: Sunday,

RE: Comprehension with two variables - explanation needed

2014-11-23 Thread Ivan Evstegneev
[target with nested loop] <--- main loop with initial values for target] On the other hand, if I'm comparing to my tryouts: noprimes = [[j for i in range(2, 8)] for j in range(i*2, 50, i)] It looks same but the variables are not separated, so it definitely was not defined Sincerely,

Comprehension with two variables - explanation needed

2014-11-23 Thread Ivan Evstegneev
uestions is still persists: 1) Is it possible to realize such a thing by applying changes only to initial comprehension? If yes, it would be nice to see the solution. 2) How actually bad is my solution? I mean, after all, there are nested functions call in my code, so how much the speed is affected(if any)? Thanks a lot in advance, Ivan. -- https://mail.python.org/mailman/listinfo/python-list

RE: Understanding "help" command description syntax - explanation needed

2014-11-05 Thread Ivan Evstegneev
standing "help" command description syntax - explanation needed On Wed, Nov 5, 2014 at 10:00 PM, Ivan Evstegneev wrote: > range(start, stop[, step]) -> range object > > For instance, how do I need to understand that (start,stop[,step]) > it’s just a three numbers? >

RE: Understanding "help" command description syntax - explanation needed

2014-11-05 Thread Ivan Evstegneev
his one(just for example): class bytearray([source[, encoding[, errors]]]) --- What does it mean? Is that I can use it in optional way? Like: class bytearray(source) or class bytearray(encoding) ? or just write down all three of them? In which format do I do so? Sincerely, Ivan. -

Understanding "help" command description syntax - explanation needed

2014-11-05 Thread Ivan Evstegneev
les. I need to get more familiar with "help", but the main problem, is that I couldn't find any suitable explanations/tutorials about "help" syntax and etc. (maybe didn't search well). Any explanations/links will be greatly appreciated. I need some help for "help" ^_^ Thanks in advance, Ivan. -- https://mail.python.org/mailman/listinfo/python-list

Re: symple programming task

2014-04-21 Thread Ivan Ivanivich
On Sunday, April 20, 2014 10:43:37 PM UTC+4, Ivan Ivanivich wrote: > hi all, i have simple programming task: > > > > [quot] > > If we list all the natural numbers below 10 that are multiples of 3 or 5, we > get 3, 5, 6 and 9. The sum of these multiples is 23. >

Re: symple programming task

2014-04-20 Thread Ivan Ivanivich
On Sunday, April 20, 2014 10:43:37 PM UTC+4, Ivan Ivanivich wrote: > hi all, i have simple programming task: > > > > [quot] > > If we list all the natural numbers below 10 that are multiples of 3 or 5, we > get 3, 5, 6 and 9. The sum of these multiples is 23. >

symple programming task

2014-04-20 Thread Ivan Ivanivich
hi all, i have simple programming task: [quot] If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. Find the sum of all the multiples of 3 or 5 below 1000. [/quote] this task from http://projecteuler.net/ site I wrote

Re: Simple Python script as SMTP server for outgoing e-mails?

2013-07-21 Thread Ivan Shmakov
> Gilles writes: > On Sun, 21 Jul 2013 11:46:52 -0600, Michael Torrie wrote: [Cross-posting to news:comp.mail.misc.] >> What you're looking for is not an SMTP server but a Mail Transfer >> Agent, called an MTA. [...] >> Dennis is correct, though, that most ISPs do block out

Re: another language with classes?

2013-06-19 Thread Ivan Shmakov
> R Kantas writes: [Cross-posting to news:comp.lang.python, news:comp.lang.scheme, looking for more first-hand experience with these. Sadly, there's no news:comp.lang.go as of yet.] > I came into first contact with objects and classes programming under > Visual Bas

__class__ and type() implementation details in CPython

2013-02-10 Thread Ivan Yurchenko
ass associated with each PyObject - _typeobject struct, which is used to identify the class by type(). Am I right? Thank you. - Ivan Yurchenko. -- http://mail.python.org/mailman/listinfo/python-list

Re: Functional way to compare things inside a list

2012-09-21 Thread Ivan@work
On 21.09.2012 00:58, thorso...@lavabit.com wrote: Hi, list = [{'1': []}, {'2': []}, {'3': ['4', '5']}] I want to check for a value (e.g. '4'), and get the key of the dictionary that contains that value. (Yep, this is bizarre.) some_magic(list, '4') => '3' What's the functional way to do it? I

Re: My first ever Python program, comments welcome

2012-07-23 Thread Ivan@work
On 21.07.2012 21:08, Lipska the Kat wrote: Greetings Pythoners A short while back I posted a message that described a task I had set myself. I wanted to implement the following bash shell script in Python Here's the script sort -nr $1 | head -${2:-10} this script takes a filename and an optio

Re: How to support a non-standard encoding?

2012-01-08 Thread Ivan
Dear jmf, Tim Thanks for these pointers. They look v useful. I'll have a go and report back (with success I hope). Best wishes Ivan On 06/01/2012 20:42, Tim Wintle wrote: On Fri, 2012-01-06 at 12:00 -0800, jmfauth wrote: The distibution of such a codec may be a problem. There

Re: How to support a non-standard encoding?

2012-01-06 Thread Ivan Uemlianin
Dear Tim Thanks for your help. > If your system version of iconv contains that encoding, ... Alas, it doesn't: $ iconv -l |grep 6937 $ Also, I'd like to package the app so other people could use it, so I wouldn't want to depend too much on the local OS. Best wi

How to support a non-standard encoding?

2012-01-06 Thread Ivan
n-standard characeter encoding? Would anyone be interested in reading one? With thanks and best wishes Ivan -- ==== Ivan A. Uemlianin Llaisdy Speech Technology Research and Development i...@llaisdy.com

Re: Wgy isn't there a good RAD Gui tool fo python

2011-07-11 Thread Ivan Kljaic
Ok. I asked about this questio because I am working with python for the last 5 years and I am always in touch about signifigact things in Python. I am pissed of that I make my living by developing applications at work in Java an C#. My comPany would switch to python but they complained that there i

Wgy isn't there a good RAD Gui tool fo python

2011-07-10 Thread Ivan Kljaic
Ok Guys. I know that most of us have been expiriencing the need for a nice Gui builder tool for RAD and most of us have been googling for it a lot of times. But seriously. Why is the not even one single RAD tool for Python. I mean what happened to boa constructor that it stopped developing. I simpl

Re: Python & Sybase

2011-04-13 Thread Ivan
Chris, There are few more, depending which sybase database. More info on this link: http://wiki.python.org/moin/Sybase Cheers, Ivan On Thu, Apr 14, 2011 at 6:36 AM, Dan Stromberg wrote: > http://www.freetds.org/ > > There's likely also one you could get from your database adm

Re: New blog from python-dev

2011-03-29 Thread Ivan Vilata i Balaguer
d to subscribe to the RSS feed (my reader doesn't support Atom) but although I'm following the link labeled as RSS, I'm still getting an Atom feed via FeedBurner. May this be a problem with FeedBurner configuration, or I'd better use another subscription mechanism? Thank

Re: Quoting quotes

2010-02-26 Thread Ivan Šipoš
On 26.2.2010. 13:29, candide wrote: Suppose you have to put into a Python string the following sentence : The play "All's Well That Ends Well" by Shakespeare It's easy do it : print """The play "All's Well That Ends Well" by Shakespeare""" The play "All's Well That Ends Well" b

Imitating "tail -f"

2009-11-21 Thread Ivan Voras
I'm trying to simply imitate what "tail -f" does, i.e. read a file, wait until it's appended to and process the new data, but apparently I'm missing something. The code is: 54 f = file(filename, "r", 1) 55 f.seek(-1000, os.SEEK_END) 56 ff = fcntl.fcntl(f.fileno(), fcntl.F_GETFL) 5

Re: Most efficient way to "pre-grow" a list?

2009-11-07 Thread Ivan Illarionov
, unsafe, unpythonic and plain evil: >>> import ctypes >>> ctypes.pythonapi.PyList_New.restype = ctypes.py_object >>> ctypes.pythonapi.PyList_New(100) -- Ivan -- http://mail.python.org/mailman/listinfo/python-list

Re: Is there a programming language that is combination of Python and Basic?

2009-04-21 Thread Ivan Illarionov
-- This will execute your BASIC program. -- Ivan -- http://mail.python.org/mailman/listinfo/python-list

Perl python - regex performance comparison

2009-03-03 Thread Ivan
uch size ? As compared to perl ?) 3. This last one is somewhat subjective, but what do you think, in the future, which will be more useful. Which, in your (humble) opinion "has a future" ? Thank you for all the info you can spare, and expecially grateful for the time in doing so. -- Ivan p

Perl-python regex-performance comparison

2009-03-03 Thread Ivan
uch size ? As compared to perl ?) 3. This last one is somewhat subjective, but what do you think, in the future, which will be more useful. Which, in your (humble) opinion "has a future" ? Thank you for all the info you can spare, and expecially grateful for the time in doing so. -- Ivan p

Perl-python regex-performance comparison

2009-03-03 Thread Ivan
uch size ? As compared to perl ?) 3. This last one is somewhat subjective, but what do you think, in the future, which will be more useful. Which, in your (humble) opinion "has a future" ? Thank you for all the info you can spare, and expecially grateful for the time in doing so. -- Ivan --

Perl / python regex / performance comparison

2009-03-03 Thread Ivan
uch size ? As compared to perl ?) 3. This last one is somewhat subjective, but what do you think, in the future, which will be more useful. Which, in your (humble) opinion "has a future" ? Thank you for all the info you can spare, and expecially grateful for the time in doing so. -- Ivan --

Re: Does the Python community really follow the philospy of "Community Matters?"

2009-01-30 Thread Ivan Illarionov
atred for Ruby and Perl seems to oppose natural Python forces, that's why you can't see community spirit. Let your hatred go and start flying already. -- Ivan -- http://mail.python.org/mailman/listinfo/python-list

Re: v = json.loads("{'test':'test'}")

2009-01-26 Thread Ivan Illarionov
;>> yaml.load("{'test':'test'}") {'test': 'test'} >>> yaml.load("{test: test}") {'test': 'test'} If someone needs more forgiving and user-editable format, YAML might be a good choice. -- Ivan -- http://mail.python.org/mailman/listinfo/python-list

Re: 'Import sys' succeeds in C++ embedded code, but module is not fully visible

2009-01-14 Thread Ivan Illarionov
On Jan 14, 8:17 pm, Ivan Illarionov wrote: > On Jan 14, 8:00 pm, Ben Sizer wrote: > > > I will try it when I get home. However I would like to be able to > > treat them as separate dictionaries, as I want to be able to import > > some symbols and modules at a global lev

Re: 'Import sys' succeeds in C++ embedded code, but module is not fully visible

2009-01-14 Thread Ivan Illarionov
code to work, it may be a separate dictionary from globals though. >From what I know 'sys' module is related to builtins. My knowledge of Python internals is not so deep to explain the details of this relationship and answer your question about sys.path[0] though. -- Ivan -- http://mail.python.org/mailman/listinfo/python-list

Re: 'Import sys' succeeds in C++ embedded code, but module is not fully visible

2009-01-14 Thread Ivan Illarionov
rence sys from within the function? Ah, sorry for wrong guess. I would try to use ourNamespace_ dict for both globals and locals in PyRun_String call. -- Ivan -- http://mail.python.org/mailman/listinfo/python-list

Re: 'Import sys' succeeds in C++ embedded code, but module is not fully visible

2009-01-13 Thread Ivan Illarionov
ter, 0, path_python_str) -- Ivan -- http://mail.python.org/mailman/listinfo/python-list

Re: C API: array of floats/ints from python to C and back

2008-12-27 Thread Ivan Illarionov
On Dec 28, 12:45 am, "Daniel Fetchinson" wrote: > I'm trying to write an extension module in C which contains a single > function with the following prototype: > > void func( int N, int * arg1, int * arg2, int * ret ); > > Here arg1 and arg2 are length N arrays, and the function computes ret > whi

Re: Custom C Exception Subclasses

2008-12-24 Thread Ivan Illarionov
On Dec 24, 10:43 pm, "Gabriel Genellina" wrote: > En Wed, 24 Dec 2008 15:48:34 -0200, Gabriel Genellina   > escribió: > > > En Wed, 24 Dec 2008 15:00:36 -0200, Ivan Illarionov   > > escribió: > > >> When you raise an exception in C++ you can set it to

Re: Custom C Exception Subclasses

2008-12-24 Thread Ivan Illarionov
any documentation for > it.  Does anyone know how to do this?  Thanks! When you raise an exception in C++ you can set it to ANY Python object via PyErr_SetObject and that object could store pointers to C++ classes. Ivan -- http://mail.python.org/mailman/listinfo/python-list

Re: Beep

2008-12-23 Thread Ivan Illarionov
gt; direction?  Thanks. > -- > Jeffrey Barish gnome-terminal (default terminal on Ubuntu) uses X11 bell for its beep. Try 'xset b on' to turn the beep on. See 'man xset' for more options. Ivan -- http://mail.python.org/mailman/listinfo/python-list

Re: PIL - font kerning

2008-12-23 Thread Ivan Illarionov
On Dec 23, 11:22 pm, Ivan Illarionov wrote: > On 23 дек, 16:44, carsn wrote: > > > Hey all, > > > anybody know, if there´s a way to specify the kerning of a font, when > > you draw text with PIL? > > > I´d like to achieve the same effect that you get, when yo

Re: PIL - font kerning

2008-12-23 Thread Ivan Illarionov
een > glyphs. > > Can PIL do that or do I use another lib for that? > > Thx for any pointers & some nice xmas days to U all! > carsten No. PIL can't do that. I suggest combination of cairo/pango/pangocairo (pycairo and pygtk packages). Ivan -- http://mail.python.org/mailman/listinfo/python-list

Re: C API and memory allocation

2008-12-18 Thread Ivan Illarionov
On 18 дек, 14:09, Ivan Illarionov wrote: > ... PyArg_ParseTuple(args, "O!", &PyStringObject, &pystr) ... Sorry, I must have said &PyString_Type, not &PyStringObject -- http://mail.python.org/mailman/listinfo/python-list

Re: C API and memory allocation

2008-12-18 Thread Ivan Illarionov
ingObject, &pystr) ... Then you can use PyString_AS_STRING explicitly, and control ref. counts yourself. > How do you know its length to copy it into your own buffer? Use the "s#" format, as Gabriel has said. Ivan -- http://mail.python.org/mailman/listinfo/python-list

Re: How to modify a program while it's running?

2008-12-16 Thread Ivan Illarionov
On Dec 16, 11:25 pm, Joe Strout wrote: > Here's my situation: I'm making an AIM bot, but the AIM server will   > get annoyed if you log in too frequently (and then lock you out for a   > while).  So my usual build-a-little, test-a-little methodology doesn't   > work too well. > > So I'd like to re

Re: Memory leak when using a C++ module for Python

2008-12-16 Thread Ivan Illarionov
retrieved with Python/C API functions that return new references (like PyObject_GetAttrString). Ivan -- http://mail.python.org/mailman/listinfo/python-list

Re: Beginner trying to understand functions.

2008-12-09 Thread Ivan Illarionov
On Dec 8, 9:02 pm, simonh <[EMAIL PROTECTED]> wrote: > Thanks for the many replies. Thanks especially to Pierre. This works > perfectly: > def getAge(): >     while True: >         try: >             age = int(input('Please enter your age: ')) >             return age > >         except ValueErr

Re: Catching Python exceptions in C

2008-12-09 Thread Ivan Illarionov
On Dec 9, 12:33 pm, Ivan Illarionov <[EMAIL PROTECTED]> wrote: > On Dec 8, 9:42 pm, Senthil Kumar <[EMAIL PROTECTED]> wrote: > > > Hi Pythoneers ! > > Can somebody give a quick solution? > > I am trying to raise exceptions in python and trying to handle

Re: Catching Python exceptions in C

2008-12-09 Thread Ivan Illarionov
On Dec 8, 9:42 pm, Senthil Kumar <[EMAIL PROTECTED]> wrote: > Hi Pythoneers ! > Can somebody give a quick solution? > I am trying to raise exceptions in python and trying to handle it in > C. > I am able to raise exceptions successfully. However could not catch > those in C. > I am using the follow

Re: More efficient array processing

2008-10-23 Thread Ivan Reborin
On Fri, 24 Oct 2008 00:32:11 +0200, Ivan Reborin <[EMAIL PROTECTED]> wrote: >On Thu, 23 Oct 2008 11:44:04 -0700 (PDT), "John [H2O]" ><[EMAIL PROTECTED]> wrote: > >> >>Thanks for the clarification. >> >>What is strange though, is that I hav

Re: More efficient array processing

2008-10-23 Thread Ivan Reborin
that would require an array of that size and that many dimensions, which couldn't be rewritten in a more efficient manner, to several smaller arrays. -- Ivan > >Thoughts on a more efficient work around? > > -- http://mail.python.org/mailman/listinfo/python-list

Re: Python arrays and sting formatting options

2008-09-30 Thread Ivan Reborin
ran84, and mean to continue doing so as long as something better doesn't come along. But as I said, got a job that't got to be done, so I'm trying to figure out how to do array operations as easily as possible in python, which are necessary for all my calculations. Best regards Ivan -- http://mail.python.org/mailman/listinfo/python-list

Re: Python arrays and sting formatting options

2008-09-30 Thread Ivan Reborin
s or something, which would allow one to load an array in a more natural "technical" way ? Like something mentioned above in my post (now deleted) ? Also, is there a way to change counter for arrays to go from 0 to 1 ? (first element being with the index 1) ? (probably not since that seems like a language implementation thing, but it doesn't hurt to ask) -- Ivan -- http://mail.python.org/mailman/listinfo/python-list

Re: Python arrays and sting formatting options

2008-09-29 Thread Ivan Reborin
ntheses. Python programmers thank you if put >them improving readability a little). Yes, ok. I can agree with that - separating the format from the variable list part sounds reasonable. > >Bye, >bearophile -- Ivan -- http://mail.python.org/mailman/listinfo/python-list

Re: Python arrays and sting formatting options

2008-09-29 Thread Ivan Reborin
3f %12.3f ... 3 times but that is just unpractical. Is there a way to just do something like this (not normal syntax, just my wishful thinking): print 3*'%12.3f' %a,b,c (meaning - use this format for the next 3 real numbers that come along) -- Ivan -- http://mail.python.org/mailman/listinfo/python-list

Python arrays and sting formatting options

2008-09-29 Thread Ivan Reborin
23456.7, 1234.000 - always 8 decimals) ? Is something like this possible (built-in) in python ? Really grateful for all the help and time you can spare. -- Ivan -- http://mail.python.org/mailman/listinfo/python-list

Re: gplt from scipy missing ?

2008-09-23 Thread Ivan Reborin
On Tue, 23 Sep 2008 13:44:41 +0200, Ivan Reborin <[EMAIL PROTECTED]> wrote: >On Tue, 23 Sep 2008 04:26:14 -0300, "Gabriel Genellina" ><[EMAIL PROTECTED]> wrote: > >> >>I think scipy does not bundle plotting packages anymore - you may use >

Re: gplt from scipy missing ?

2008-09-23 Thread Ivan Reborin
s. Do you know, by any chance, where one could get gplt separately, or for example, get older versions of scipy ? I'm using python 5.2.2.. If I install scipy for python 2.3. for example (let's assume that one still has gplt in it) will it work ? Best regards Ivan -- http://mail.python.org/mailman/listinfo/python-list

  1   2   3   4   5   6   >